https://github.com/uphold/itin-validator
Validate and mask a U.S. Individual Taxpayer Identification Number (ITIN)
https://github.com/uphold/itin-validator
Last synced: 3 months ago
JSON representation
Validate and mask a U.S. Individual Taxpayer Identification Number (ITIN)
- Host: GitHub
- URL: https://github.com/uphold/itin-validator
- Owner: uphold
- License: mit
- Created: 2015-10-06T17:16:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T21:35:09.000Z (about 2 years ago)
- Last Synced: 2025-02-09T12:34:50.221Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 58
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# itin-validator
Validate and mask a U.S. Individual Taxpayer Identification Number (ITIN).## Status
[![npm version][npm-image]][npm-url] [![build status][travis-image]][travis-url]## Installation
Install the package via `npm`:```sh
npm install itin-validator --save
```## Usage
### `isValid(value)`
This method validates if the given value is a valid `Individual Taxpayer Identification Number`.#### Arguments
1. `value` _(*)_: The value to validate.#### Returns
_(boolean)_: Returns whether the input value is a valid ITIN or not.#### Example
```js
isValid({});
// => falseisValid('9-0-0700000');
// => falseisValid('900-70-0000');
// => trueisValid('900700000');
// => true
```--------------------------------------------------------------------------------
### `mask(value)`
This method will help you protect this sensitive piece of information by obfuscating some digits.#### Arguments
1. `value` _(*)_: The value to mask.#### Returns
_(string)_: Returns the masked value by replacing value certain digits by 'X'.#### Example
```js
mask({});
// Throws an Error.mask('9-0-0700000');
// Throws an Error.mask('900-70-0000');
// => XXX-XX-0000mask('900700000');
// => XXXXX0000
```--------------------------------------------------------------------------------
## Tests
To test using a local installation of `node.js`:```sh
npm test
```To test using Docker exclusively:
```sh
docker-compose run --rm sut
```## Release
```sh
npm version [ | major | minor | patch] -m "Release %s"
```## License
MIT[npm-image]: https://img.shields.io/npm/v/itin-validator.svg?style=flat-square
[npm-url]: https://npmjs.org/package/itin-validator
[travis-image]: https://img.shields.io/travis/uphold/itin-validator.svg?style=flat-square
[travis-url]: https://img.shields.io/travis/uphold/itin-validator.svg?style=flat-square