Wondering what’s next for npm?Check out our public roadmap! »

    num-match

    1.0.1 • Public • Published

    num-match

    Verbal number classifier

    npm i num-match
    const numMatch = require('num-match');
    // or
    const numMatch from 'num-match';

    Create array of verbal rules:

    const rules = [
      '&2=baby', // till 2
      '3&8=child', // from 3 to 8
      '9&18=teenager',
      '19&26!=student', // from 19 to 26 (26 not include)
      // use ! to not to "include"
      '26&=grownup' // from 26
    ];

    Create your func and use:

    const match = numMatch(rules);
     
    match(0); // baby
    match(5); // child
    match(14); // teenager
    match(25); // student
    match(99); // grownup

    Feature

    const rules = [
      '17=Just 17' // strict 17
    ];
    const match = numMatch(rules);
    match(17); // Just 17
    match(100); // false (no match)

    Test

    npm test

    Install

    npm i num-match

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    3.82 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar