0.2.0 • Published 8 years ago

maybe2 v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

(Just to get this https://gist.github.com/andyhd/1618403 as a module, with a little bit of sugar). So the following constructions are now possible:

var greaterThan = function (num) { return function (x) { return x > num ? x:null; }; };
var lessThan = function (num) { return function (x) { return x < num ? x:null; }; };
var definitelyUndefined;
log('All together: ', maybe(definitelyUndefined)
                        .is(Number)
                        .map(greaterThan(0))
                        .map(lessThan(42))
                        .getOrElse(9000));

Take a look at the example.js or test.js for more info. (All glory goes to @andyhd)

0.2.0

8 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago