Git Product home page Git Product logo

lunh's Introduction

Lunh

Simple implementation of the Lunh Algorithm which can be useful to check credit card ๐Ÿ’ณ before processing.

Get Started

Install

npm i @recodable/lunh

or

yarn add @recodable/lunh

Example

import { lunh } from '@recodable/lunh';
// or `const { lunh } = require('@recodable/lunh');` for Node.js module

lunh('4242424242424242'); // returns true as "4242424242424242" is valid credit card

lunh('4242424242424241'); // returns false for invalid credit card

lunh('4242 4242 4242 4242'); // we also accept spaces

lunh('4242-4242-4242-4242'); // and dashes

lunh('424242424242hello'); // returns false if anything else is pass to the function

Credit

Inspired by DiegoSalazar

lunh's People

Contributors

aktraore avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

lunh's Issues

Fail export default for Node.js in ES5

At the moment, we use ES6 export default method which then compile down to module.default, creating a mess on how you use the library on Node (cf. example below)

const lunh = require('@recodable/lunh');
// this works
lunh.default('4242');

// this doesn't but should
lunh('4242');

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.