0.0.11 • Published 6 years ago

@berhalak/monads v0.0.11

Weekly downloads
17
License
MIT
Repository
github
Last release
6 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

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago