1.0.2 • Published 4 years ago
allowedcharacters v1.0.2
allowed-characters
Throw an error if a string contains unallowed characters
Installation
npm i --save allowedcharacters
Usage
allowedCharacters -> allowed -> string -> string|error
1. Correct characters
allowedCharacters('123', '123') === '123';
2. Incorrect characters
allowedCharacters('123', '1234')
// throws error: 'contained unallowed character "4"'