Typescript collection of validators and regexp patterns
To install run:
npm i @currency-one/validators
or
yarn add @currency-one/validators
Basic usage with React and build systems (webpack, parcel etc.):
import { isNotEmptyStringValidator, isAccountNumberPattern } from '@currency-one/validators'
export const notEmptyValidator = (value) => {
return !isNotEmptyStringValidator(value) ? 'This field cant be empty' : ''
}
export const accountNumberPattern = (value) => {
return !isAccountNumberPattern(value) ? 'This field can contain only: letters, numbers and space' : ''
}
See documentation for more details