Giter VIP home page Giter VIP logo

luhn.js's Introduction

luhn.js

npm Bower Travis

Fastest JavaScript implementation of the Luhn algorithm.

Benchmarks here.

This algorithm (also known as Luhn formula) is useful to validate a variety of identification numbers (e.g. credit card numbers).

Install

~1KB.

UMD builds for development - index.js and index.js.map - and production - index.min.js - available.

So it's installable both on node and/or for browsers.

$ npm install luhn-alg
$ bower install luhn-alg

Usage

Simplest API ever.

luhn(x: number): boolean

Node.js

Try it in node.

$ > var luhn = require('luhn-alg');
$ > luhn('4242424242424242');
$ true

Browsers

Include the UMD build (e.g., index.min.js) and you'll have a luhn function on the window/global scope.

Or use CommonJS, AMD, WTFYW etc.

Tests

This project is fully unit tested on:

Credits

  • ShirtlessKirk's popular gist
  • Anyone contributing and improving performances

Analytics

luhn.js's People

Contributors

leodido avatar

Stargazers

ik5 avatar  avatar Alin Ionuț Ghinoiu avatar Rubens Mariuzzo avatar K avatar Abcat avatar nick avatar Antoine Lépée avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

Forkers

4st1nus whitelynx

luhn.js's Issues

Replace bundling system

  • replace browserify with rollupjs
  • deprecate node 0.10
  • support node 4 and latest node stable release
  • review saucelabs support
  • umd bundle
  • remove gulp dependency
  • publish on bower registry

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.