UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

26 lines (24 loc) 568 B
const isValidInput = (inputValue, type) => { if (inputValue.length !== 1) return false; switch (type) { case 'number': { return /^\d$/.test(inputValue); } default: { return /^.$/.test(inputValue); } } }; const extractValidChars = (text, type) => { switch (type) { case 'number': { return text.replaceAll(/\D/g, ''); } default: { return text; } } }; export { extractValidChars, isValidInput }; //# sourceMappingURL=utils.js.map