bsn-js
v1.0.4
Published
Generator/validator for (Dutch) BSNs
Downloads
614
Maintainers
Readme
bsn-js
bsn-js can be used to generate a test BSN (burger service nummer) or validate an existing BSN
works for JavaScript and TypeScript (type definitions included)
installation
npm install bsn-js
or using yarn
yarn add bsn-js
usage
validate existing BSN
import { isValidBSN } from 'bsn-js'
or
const { isValidBSN } = require('bsn-js')
pass the BSN (string) to the function and it will return true
or false
example: const validBSN = isValidBSN('12312312') # false
generate BSN for testing
import { generateBSN } from 'bsn-js'
or
const { generateBSN } = require('bsn-js)
test BSNs will consist of 9 characters
the Dutch authority has reserved BSNs starting with 0000 and 99999 for testing
the generetated BSN will start with 99999 by default
const bsn = generateBSN() # 999999400
when the function generateBSN is given true as argument, it will return a BSN starting with 0000
const bsn = generateBSN(true) # 000078840