Socket
Socket
Sign inDemoInstall

cdigit

Package Overview
Dependencies
0
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cdigit

Generate and validate check digits


Version published
Weekly downloads
4.4K
increased by25.76%
Maintainers
1
Install size
41.3 kB
Created
Weekly downloads
 

Readme

Source

cdigit

Generate and validate check digits

SYNOPSIS

const cdigit = require('cdigit');

// Generate and validate check digits using Luhn algorithm
console.log(cdigit.luhn.generate('1234'));  // '4'
console.log(cdigit.luhn.encode('1234'));    // '12344'
console.log(cdigit.luhn.validate('12344')); // true
console.log(cdigit.luhn.validate('12345')); // false

// Generate and validate check digits using Verhoeff algorithm
console.log(cdigit.verhoeff.generate('1234'));  // '0'
console.log(cdigit.verhoeff.encode('1234'));    // '12340'
console.log(cdigit.verhoeff.validate('12340')); // true
console.log(cdigit.verhoeff.validate('12345')); // false

Keywords

FAQs

Last updated on 11 Nov 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc