Comparing version 0.5.2 to 0.5.3
@@ -20,3 +20,3 @@ /*global define*/ | ||
}(global || window || this, function(FL){ | ||
}(/* istanbul ignore next */(global || window || this), function(FL){ | ||
@@ -52,7 +52,7 @@ 'use strict'; | ||
: typeof x === 'function' | ||
? typeof x.name === 'string' | ||
? typeof x.name === 'string' && x.name.length > 0 | ||
? `[Function ${x.name}]` | ||
: '[Function]' | ||
: x && x.toString === Object.prototype.toString | ||
? `{${Object.keys(x).map(String).join(', ')}}` | ||
? `[Object ${Object.keys(x).map(String).join(', ')}]` | ||
: String(x); | ||
@@ -254,3 +254,3 @@ | ||
const _this = this; | ||
return new FutureClass(function Future$ap$fork(g, h){ | ||
return new FutureClass(function Future$ap$fork(g, res){ | ||
let _f, _x, ok1, ok2, ko; | ||
@@ -261,3 +261,3 @@ const rej = x => ko || (ko = 1, g(x)); | ||
check$ap$f(f); | ||
h(f(_x)); | ||
res(f(_x)); | ||
}); | ||
@@ -267,3 +267,3 @@ m._f(rej, function Future$ap$resThat(x){ | ||
check$ap$f(_f); | ||
h(_f(x)); | ||
res(_f(x)); | ||
}); | ||
@@ -270,0 +270,0 @@ }); |
{ | ||
"name": "fluture", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "A complete Fantasy Land compatible Future library", | ||
@@ -17,3 +17,3 @@ "main": "fluture.js", | ||
"test:opt": "node --allow-natives-syntax --trace-opt --trace-deopt --trace-inlining scripts/test-opt", | ||
"test:unit": "mocha --ui bdd --reporter spec --check-leaks --full-trace" | ||
"test:unit": "node --harmony-destructuring node_modules/.bin/istanbul cover --report html ./node_modules/.bin/_mocha -- --ui bdd --reporter spec --check-leaks --full-trace" | ||
}, | ||
@@ -33,3 +33,4 @@ "author": "Aldwin Vlasblom <aldwin.vlasblom@gmail.com> (https://github.com/Avaq)", | ||
"eslint": "^2.2.0", | ||
"isparta": "^4.0.0", | ||
"istanbul": "^0.4.2", | ||
"jsverify": "^0.7.1", | ||
"mocha": "^2.3.3", | ||
@@ -36,0 +37,0 @@ "nsp": "^2.2.0", |
# Fluture | ||
[![NPM Version](https://badge.fury.io/js/fluture.svg)](https://www.npmjs.com/package/fluture) | ||
[![Dependencies](https://david-dm.org/avaq/fluture.svg)](https://david-dm.org/avaq/fluture) | ||
[![Build Status](https://travis-ci.org/Avaq/Fluture.svg?branch=master)](https://travis-ci.org/Avaq/Fluture) | ||
A complete [Fantasy Land][1] compatible Future library. | ||
@@ -61,3 +65,6 @@ | ||
eventualThing.fork(console.error, thing => console.log(`Hello ${thing}!`)); | ||
eventualThing.fork( | ||
console.error, | ||
thing => console.log(`Hello ${thing}!`) | ||
); | ||
//> "Hello world!" | ||
@@ -72,3 +79,6 @@ ``` | ||
const eventualThing = Future.of('world'); | ||
eventualThing.fork(console.error, thing => console.log(`Hello ${thing}!`)); | ||
eventualThing.fork( | ||
console.error, | ||
thing => console.log(`Hello ${thing}!`) | ||
); | ||
//> "Hello world!" | ||
@@ -94,3 +104,4 @@ ``` | ||
const data = {foo: 'bar'} | ||
Future.try(() => data.foo.bar.baz).fork(console.error, console.log) | ||
Future.try(() => data.foo.bar.baz) | ||
.fork(console.error, console.log) | ||
//> [TypeError: Cannot read property 'baz' of undefined] | ||
@@ -189,3 +200,5 @@ ``` | ||
```js | ||
Future.of(1).map(x => x + 1).fork(console.error, console.log); | ||
Future.of(1) | ||
.map(x => x + 1) | ||
.fork(console.error, console.log); | ||
//> 2 | ||
@@ -200,3 +213,5 @@ ``` | ||
```js | ||
Future.of(1).chain(x => Future.of(x + 1)).fork(console.error, console.log); | ||
Future.of(1) | ||
.chain(x => Future.of(x + 1)) | ||
.fork(console.error, console.log); | ||
//> 2 | ||
@@ -225,3 +240,5 @@ ``` | ||
```js | ||
Future.of(x => x + 1).ap(Future.of(1)).fork(console.error, console.log); | ||
Future.of(x => x + 1) | ||
.ap(Future.of(1)) | ||
.fork(console.error, console.log); | ||
//> 2 | ||
@@ -252,6 +269,10 @@ ``` | ||
```js | ||
Future.of('hello').fold(S.Left, S.Right).fork(noop, console.log); | ||
Future.of('hello') | ||
.fold(S.Left, S.Right) | ||
.value(console.log); | ||
//> Right('hello') | ||
Future.reject('it broke').fold(S.Left, S.Right).fork(noop, console.log); | ||
Future.reject('it broke') | ||
.fold(S.Left, S.Right) | ||
.value(console.log); | ||
//> Left('it broke') | ||
@@ -340,17 +361,4 @@ ``` | ||
* [x] Implement Future Monad | ||
* [x] Write tests | ||
* [x] Write benchmarks | ||
* [ ] Implement Traversable? | ||
* [x] Implement Future.cache | ||
* [ ] Implement Future#mapRej | ||
* [x] Implement Future#chainRej | ||
* [x] Implement dispatchers | ||
* [ ] Implement Future#swap | ||
* [ ] Implement Future#and | ||
* [ ] Implement Future#or | ||
* [x] Implement Future#fold | ||
* [x] Implement Future#value | ||
* [x] Implement Future#race | ||
* [x] Implement Future.parallel | ||
* [ ] Implement Future.predicate | ||
@@ -360,7 +368,6 @@ * [ ] Implement Future#promise | ||
* [ ] Implement Future.encase | ||
* [x] Check `this` on instance methods | ||
* [x] Create documentation | ||
* [ ] Implement [Profunctor][8] | ||
* [ ] Wiki: Comparison between Future libs | ||
* [ ] Wiki: Comparison Future and Promise | ||
* [ ] Add test coverage | ||
* [x] Add test coverage | ||
* [ ] Add readme badges | ||
@@ -395,1 +402,2 @@ * [ ] A transpiled ES5 version if demand arises | ||
[7]: http://sanctuary.js.org/#either-type | ||
[8]: https://github.com/fantasyland/fantasy-land/pull/124 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27608
394
10