bsn-js 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/lib/generator.js +1 -1
- package/lib/generator.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,2 +1,60 @@
|
|
|
1
1
|
[](https://github.com/willemverbuyst/bsn-js/actions/workflows/lint-test-build.yml)
|
|
2
2
|
[](https://github.com/willemverbuyst/bsn-js/actions/workflows/pages/pages-build-deployment)
|
|
3
|
+
|
|
4
|
+
# bsn-js
|
|
5
|
+
|
|
6
|
+
bsn-js can be used to generate a test BSN (burger service nummer) or validate an existing BSN
|
|
7
|
+
|
|
8
|
+
## installation
|
|
9
|
+
|
|
10
|
+
`npm install bsn-js`
|
|
11
|
+
|
|
12
|
+
or using yarn
|
|
13
|
+
|
|
14
|
+
`yarn add bsn-js`
|
|
15
|
+
|
|
16
|
+
<br>
|
|
17
|
+
|
|
18
|
+
## usage
|
|
19
|
+
|
|
20
|
+
#### validate existing BSN
|
|
21
|
+
|
|
22
|
+
`import { isValidBSN } from 'bsn-js'`
|
|
23
|
+
|
|
24
|
+
or
|
|
25
|
+
|
|
26
|
+
`const { isValidBSN } = require('bsn-js')`
|
|
27
|
+
|
|
28
|
+
pass the BSN (string) to the function and it will return `true` or `false`
|
|
29
|
+
|
|
30
|
+
example: `const validBSN = isValidBSN('12312312')` <span style="color:grey"># false</span>
|
|
31
|
+
|
|
32
|
+
<br>
|
|
33
|
+
|
|
34
|
+
#### generate BSN for testing
|
|
35
|
+
|
|
36
|
+
`import { generateBSN } from 'bsn-js'`
|
|
37
|
+
|
|
38
|
+
or
|
|
39
|
+
|
|
40
|
+
`const { generateBSN } = require('bsn-js)`
|
|
41
|
+
|
|
42
|
+
test BSNs will consist of 9 characters
|
|
43
|
+
|
|
44
|
+
the Dutch authority has reserved BSNs starting with 0000 and 99999 for testing
|
|
45
|
+
|
|
46
|
+
the generetated BSN will start with 99999 by default
|
|
47
|
+
|
|
48
|
+
`const bsn = generateBSN()` <span style="color:grey"># 999999400</span>
|
|
49
|
+
|
|
50
|
+
when the function generateBSN is given true as argument, it will return a BSN starting with 0000
|
|
51
|
+
|
|
52
|
+
`const bsn = generateBSN(true)` <span style="color:grey"># 000078840</span>
|
|
53
|
+
|
|
54
|
+
<br>
|
|
55
|
+
|
|
56
|
+
## information BSN
|
|
57
|
+
|
|
58
|
+
[offical docs](https://www.government.nl/topics/personal-data/citizen-service-number-bsn)
|
|
59
|
+
|
|
60
|
+
[11 check](https://en.wikipedia.org/wiki/Check_digit)
|
package/lib/generator.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.generateBSN = void 0;
|
|
|
4
4
|
var generateBSN = function (withLeadingZeroes) {
|
|
5
5
|
var bsn = {
|
|
6
6
|
leading: '9999',
|
|
7
|
-
i4:
|
|
7
|
+
i4: 9,
|
|
8
8
|
i5: Math.floor(Math.random() * 10),
|
|
9
9
|
i6: Math.floor(Math.random() * 10),
|
|
10
10
|
i7: Math.floor(Math.random() * 10),
|
package/lib/generator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"/","sources":["generator.ts"],"names":[],"mappings":";;;AAgBO,IAAM,WAAW,GAAG,UAAC,iBAA2B;IACtD,IAAM,GAAG,GAAQ;QAChB,OAAO,EAAE,MAAM;QACf,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"/","sources":["generator.ts"],"names":[],"mappings":";;;AAgBO,IAAM,WAAW,GAAG,UAAC,iBAA2B;IACtD,IAAM,GAAG,GAAQ;QAChB,OAAO,EAAE,MAAM;QACf,EAAE,EAAE,CAAC;QACL,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;QAClC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAA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