barcode-validator

1.0.2 • Public • Published

Barcode Validator npm package

A tiny JavaScript library for validating barcodes.

Supported symbologies: EAN-13, EAN-8, UPC-A, and UPC-E. For more information on the validation algorithm, see official GS1 guide on calculating valid barcode check digits.


Usage

First, install barcode-validator using npm:

npm i barcode-validator

Then, import the package into your module like so:

import validbarcode from "barcode-validator";
// or const validbarcode = require("barcode-validator");

Pass it a barcode (string or number) for validation and get back a boolean.

validbarcode("6151100036810"); // true
validbarcode(87162318); // true
validbarcode(972660036810); // false

License

Barcode Validator is MIT licensed. See license file for more information.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    2,738
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    2,738
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i barcode-validator

Weekly Downloads

2,738

Version

1.0.2

License

MIT

Unpacked Size

3.48 kB

Total Files

5

Last publish

Collaborators

  • temideoye