Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/willemverbuyst/bsn-js
NPM package with validator and generator of BSNs
https://github.com/willemverbuyst/bsn-js
eslint githubactions npm typescript
Last synced: 24 days ago
JSON representation
NPM package with validator and generator of BSNs
- Host: GitHub
- URL: https://github.com/willemverbuyst/bsn-js
- Owner: willemverbuyst
- Created: 2022-02-06T06:09:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-12T04:16:26.000Z (9 months ago)
- Last Synced: 2024-10-06T06:02:34.154Z (about 1 month ago)
- Topics: eslint, githubactions, npm, typescript
- Language: TypeScript
- Homepage:
- Size: 289 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![lint-test-build](https://github.com/willemverbuyst/bsn-js/actions/workflows/lint-test-build.yml/badge.svg)](https://github.com/willemverbuyst/bsn-js/actions/workflows/lint-test-build.yml)
# 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`
## information BSN
[official docs](https://www.government.nl/topics/personal-data/citizen-service-number-bsn)
[11 check](https://en.wikipedia.org/wiki/Check_digit)
[bsn-tool](https://github.com/willemverbuyst/bsn-tool)