itin-validator
Validate and mask a U.S. Individual Taxpayer Identification Number (ITIN).Status
!npm versionnpm-imagenpm-url !build statustravis-imagetravis-urlInstallation
Install the package vianpm
:npm install itin-validator --save
Usage
isValid(value)
This method validates if the given value is a valid Individual Taxpayer Identification Number
.Arguments
value
(): The value to validate.
Returns
(boolean): Returns whether the input value is a valid ITIN or not.Example
isValid({});
// => false
isValid('9-0-0700000');
// => false
isValid('900-70-0000');
// => true
isValid('900700000');
// => true
mask(value)
This method will help you protect this sensitive piece of information by obfuscating some digits.Arguments
value
(): The value to mask.
Returns
(string): Returns the masked value by replacing value certain digits by 'X'.Example
mask({});
// Throws an Error.
mask('9-0-0700000');
// Throws an Error.
mask('900-70-0000');
// => XXX-XX-0000
mask('900700000');
// => XXXXX0000
Tests
To test using a local installation ofnode.js
:npm test
To test using Docker exclusively:
docker-compose run --rm sut
Release
npm version [<newversion> | major | minor | patch] -m "Release %s"