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