Validate and mask a U.S. Employer Identification Number (EIN).
Install the package via npm
:
npm install ein-validator --save
This method validates if the given value is a valid Employer Identification Number
.
value
(*): The value to validate.
(boolean): Returns whether the input value is a valid EIN or not.
isValid({});
// => false
isValid('0112345-67');
// => false
isValid('01-1234567');
// => true
isValid('011234567');
// => true
This method will help you protect this sensitive piece of information by obfuscating some digits.
value
(*): The value to mask.
(string): Returns the masked value by replacing value certain digits by 'X'.
mask({});
// Throws an Error.
mask('0112345-67');
// Throws an Error.
mask('01-1234567');
// => XX-XXX0000
mask('011234567');
// => XXXXX4567
To test using a local installation of node.js
:
npm test
To test using Docker exclusively:
docker-compose run --rm sut
npm version [<newversion> | major | minor | patch] -m "Release %s"
MIT