0.0.11 • Published 5 years ago

@berhalak/monads v0.0.11

Weekly downloads
17
License
MIT
Repository
github
Last release
5 years ago

monads

Typescript monads

// sample usage
expect(lift(lift(5)).map(x => x + 6).value()).toBe(11);

// from constants
expect(lift(5).map(x => x + 6).value()).toBe(11);
expect(some(5).map(x => x + 6).value()).toBe(11);

// async support
expect(await wait(lift(5)).map(x => x + 6).value()).toBe(11);

// constant map
expect(await wait(5).map(x => x + 6).value()).toBe(11);
expect(await wait(5).map(x => x + 6).value()).toBe(11);

// move from normal monad to async
expect(await lift(4).map(async x => x + 5).wait().map(x=> x + 2).value()).toBe(11);

// fluent selector
expect(from([1,2]).map(x => x + 1).toArray()).toStrictEqual([2,3]);
0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago