Miss any of our Open RFC calls?Watch the recordings here! »

euro-banknote-serialnumber

0.1.1 • Public • Published

Euro banknote serialnumber

ZERO DEPENDENCIES

This module will verify/validate that a given serial number is a valid Euro banknote serial number.

The list of allowed country codes (and corresponding checksum digits) can be found in this wikipedia page.

I converted this to javascript from an old C assignment I did at university, see /old_c/checksum.c.

Install

To use in a node application:

npm install euro-banknote-serialnumber

To use as a cli tool

npm install -g euro-banknote-serialnumber

Usage

In a node application:

const euroBanknoteSN = require("euro-banknote-serialnumber")
 
const check1 = euroBanknoteSN.verify("L25388049086")
// check1 === false (it's invalid)
 
const check2 = euroBanknoteSN.verify("X30284111711")
// check2 === true (it's a valid series 1 banknote serial number)
 
const check3 = euroBanknoteSN.verify("NA4532489209")
// check3 === true (it's a valid series 2 banknote serial number)

As a cli tool:

euro-banknote-serialnumber --help
euro-banknote-serialnumber -h
euro-banknote-serialnumber
# outputs help about the command 
 
euro-banknote-serialnumber --verify L25388049086
# outputs 'invalid' and return code is 1 (so you can use it in pipes) 
 
euro-banknote-serialnumber --verify X30284111711
# outputs 'valid: X30284111711' and return code 0 (so you can use it in pipes) 
 
euro-banknote-serialnumber --verify NA4532489209
# outputs 'valid: NA4532489209' and return code 0 (so you can use it in pipes) 

License

MIT

Install

npm i euro-banknote-serialnumber

DownloadsWeekly Downloads

4

Version

0.1.1

License

MIT

Last publish

Collaborators

  • avatar