@recodable/lunh
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.5 • Public • Published

    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

    Install

    npm i @recodable/lunh

    DownloadsWeekly Downloads

    8

    Version

    1.0.5

    License

    ISC

    Unpacked Size

    57.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar