Nemo's Parental Misguidance

    simplematch
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.0 • Public • Published

    simplematch

    simple pattern match for typescript

    Install

    npm i simplematch
    

    example

    type DemoType = 'cat' | 'dog' | 'bird';
     
    const result = match<DemoType, string>({
      cat: () => 'return a string',
      dog: () => 'return another string',
      bird: () => 'oh',
    });
     
    const result2 = match<DemoType, boolean>({
      cat: () => true,
      dog: () => false,
      bird: () => true,
    });

    Keywords

    Install

    npm i simplematch

    DownloadsWeekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    1.74 kB

    Total Files

    5

    Last publish

    Collaborators

    • zhanba