1.1.6 • Published 4 years ago

ts-match v1.1.6

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

ts-match

A small matching library for TypeScript. The API is a single function defined as:

function match<T, R>(input: T, defaultCase: IDefaultCase<R>, ...cases: ICase<T, R>[]): R

Example:

const s: Foo = new C(5, `test string`);
const result = match<Foo, number>(s,
    _(-42),
    when(A, s => s.a),
    when(B, s => s.b),
    when(C, s => s.c),
);
1.1.6

4 years ago

1.1.5

4 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.0

7 years ago