New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

lib-mod10

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lib-mod10

A module for checking numbers against luhn algorithm

latest
Source
npmnpm
Version
1.2.2
Version published
Maintainers
1
Created
Source

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

Keywords

node

FAQs

Package last updated on 18 Jun 2019

Did you know?

Socket

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