koblas / stdnum-js

A JavaScript library to provide functions to handle, parse and validate standard numbers.
MIT License
39 stars 26 forks source link

False positives for Netherlands / BSN that are too short #17

Closed mikeryancodes closed 2 years ago

mikeryancodes commented 2 years ago

Sample code producing the error:

const { stdnum } = require('stdnum');
const { bsn } = stdnum.NL;
bsn.validate('1').isValid; // true, should be false

It looks like validate is converting value to a string padded with 0s up to a length of 9 via clean before doing the length check, the length will always be 9 due to the padding.

mikeryancodes commented 2 years ago

This also appears in onderwijsnummer, though that winds up getting caught by a format check for the first two digits. Still, I think we would want to see it fail a length check.

koblas commented 2 years ago

This is now resolved, closing.