is-national-insurance-number
v1.0.0
Published
Validates string is a UK National Insurance number
Downloads
537
Maintainers
Readme
is-national-insurance-number
This module provides a function to validate UK National Insurance numbers.
It validates strings strictly (must be upper case, contain no spaces, dashes etc).
I recommend santising your input before validation.
Installing
npm install is-national-insurance-number --save
Example usage
const isNino = require('is-national-insurance-number');
isNino('AA111111A'); // true
isNino('thrasdfag'); // false
Using provided sanitiser:
const sanitiseNino = require('is-national-insurance-number/sanitise-nino');
sanitiseNino('aa 11 22 33 a'); // AA112233A
sanitiseNino('AA-11-22-33-A'); // AA112233A
sanitiseNino('aa112233A! 😺'); // AA112233A
Pull requests welcome!