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,
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    1

Package Sidebar

Install

npm i simplematch

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

1.74 kB

Total Files

5

Last publish

Collaborators

  • zhanba