Package Exports
- bsn-js
- bsn-js/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bsn-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
bsn-js
what is this?
The bsn-js package can be used to generate a test BSN (burger service nummer) or to validate an existing BSN.
It works for JavaScript and TypeScript (type definitions included).
installation
npm install bsn-js
usage
validate existing BSN
import { isValidBSN } from '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'
The test BSNs will consist of 9 characters. The Dutch authority has reserved BSNs starting with 0000 and 99999 for testing.
The generated 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