1.0.1 • Published 6 years ago

polish-id-card-validate v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Simple polish ID card number validator

Build Status License NPM Version Downloads

Currently polish ID card numbers contains of three letters and six digits. Valid numbers are written in format "XXX NNNNNN", where "X" is a letter and "X" is a digit. The space character is optional.

The control digit is first digit, after letters. For example in number: "ABS 123456" control digit equal "1".

In algorithm of control digit validation letters are presented as numbers, where "A" equal "10" and "Z" qeual "35". In polish ID card are allowed only latin letters.

Using validator:

First steep - instalation from NPM:

npm install polish-id-card-validate

Using validator in the application code:

const validate = require( 'polish-id-card-validate' );

validate( 'ABS123456' ); //true
validate( 'abs123456' ); //true

validate( 'ABS 123456' ); //true
validate( 'abs 123456' ); //true

validate( 'ABS523456' ); //false, invalid control digit!

Validator can be use only for new ID card numbers in format "XXX NNNNNN". For old ID card numbers (without control digit) validator returns always FALSE.