JSPM

lib-mod10

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q15227F
  • License MIT

A module for checking numbers against luhn algorithm

Package Exports

  • lib-mod10

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lib-mod10) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lib-mod10

A node module for checking numbers against luhn algorithm

Installation

yarn add lib-mod10

Usage

The library exposes two methods:

  • compute() => Compute checksum for input number
  • check() => Checks input number against luhn algorithm

Compute

// Import lib-mod10
import Mod10 from 'lib-mod10'

// Compute checksum for a random number
const cheksum = Mod10.compute('1234567890') // Should output 3

Check

// Import lib-mod10
import Mod10 from 'lib-mod10'

// Check random number against luhn algorithm
const isValid = Mod10.check('12345678903') // Should output true

Demo

You can try this module on codepen