Receiving an unexpected error when trying to parse random strings. I'd expect it to return null
like in the documentation, not throw an error:
Error: unknown format
at format (node_modules/sweden-national-id/dist/format.js:24:19)
at parse (node_modules/sweden-national-id/dist/national-id-number.js:24:50)
at isValidSSN (file:///home/perry/<snip>/bots/dist/test/projects/shared/library/ssn.js:6:20)
at validateStringWithoutPII (file:///home/perry/<snip>/bots/dist/test/projects/shared/schemaHelpers.js:136:13)
at Context.<anonymous> (file:///home/perry/<snip>/bots/dist/test/test/shared/unit/schemaHelpers.spec.js:40:20)
at process.processImmediate (node:internal/timers:478:21)
Value can be literally anything, and it breaks.
For instance, I was testing segments of a piece of text, looking for a Swedish SSN, and it broke on every value:
SSN TEST: my
SSN TEST: number
SSN TEST: is
SSN TEST: my
SSN TEST: number
SSN TEST: is
SSN TEST: 0439200192.
I'm using Node 20 under docker, with typescript v5.