@xornot/match
Functional replacement for the switch statement.
Last updated 2 years ago by chrisackerman .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @xornot/match 
SYNC missed versions from official npm registry.

xornot.io match

Functional replacement for the switch statement.

With match:

const result = match<string, number>(value)
  .if("foo", () => 1)
  .if(["bar", "baz"], () => 2)
  .else(() => 3);

Without match:

let result: number;

switch (value) {
  case "foo":
    result = 1;
    break;
  case "bar":
  case "baz":
    result = 2;
    break;
  default:
    result = 3;
}

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |