Preview: removeInvalidChars.ts
Size: 320 B
/home/byroehnu/easepaybiz.easetack.com/node_modules/react-currency-input-field/src/components/utils/removeInvalidChars.ts
import { escapeRegExp } from './escapeRegExp';
/**
* Remove invalid characters
*/
export const removeInvalidChars = (value: string, validChars: ReadonlyArray<string>): string => {
const chars = escapeRegExp(validChars.join(''));
const reg = new RegExp(`[^\\d${chars}]`, 'gi');
return value.replace(reg, '');
};
Directory Contents
Dirs: 1 × Files: 15