Comparing version 6.2.6 to 6.2.7
{ | ||
"name": "fluture", | ||
"version": "6.2.6", | ||
"version": "6.2.7", | ||
"description": "FantasyLand compliant (monadic) alternative to Promises", | ||
@@ -63,3 +63,3 @@ "main": "index.js", | ||
"data.task": "^3.0.0", | ||
"eslint": "^3.0.1", | ||
"eslint": "^4.0.0", | ||
"eslint-config-warp": "^1.2.0", | ||
@@ -79,3 +79,3 @@ "eslint-plugin-markdown": "^1.0.0-beta.6", | ||
"rimraf": "^2.4.3", | ||
"rollup": "^0.42.0", | ||
"rollup": "^0.43.0", | ||
"rollup-plugin-buble": "^0.15.0", | ||
@@ -82,0 +82,0 @@ "rollup-plugin-istanbul": "^1.1.0", |
@@ -5,3 +5,3 @@ import {show, showf, noop, moop} from './internal/fn'; | ||
import {$$type} from './internal/const'; | ||
import interpretor from './internal/interpretor'; | ||
import interpreter from './internal/interpreter'; | ||
import type from 'sanctuary-type-identifiers'; | ||
@@ -362,2 +362,33 @@ | ||
function Eager(future){ | ||
this.rej = noop; | ||
this.res = noop; | ||
this.rejected = false; | ||
this.resolved = false; | ||
this.value = null; | ||
this.cancel = future._fork(x => { | ||
this.value = x; | ||
this.rejected = true; | ||
this.cancel = noop; | ||
this.rej(x); | ||
}, x => { | ||
this.value = x; | ||
this.resolved = true; | ||
this.cancel = noop; | ||
this.res(x); | ||
}); | ||
} | ||
Eager.prototype = Object.create(Core); | ||
Eager.prototype._fork = function Eager$_fork(rej, res){ | ||
if(this.rejected) rej(this.value); | ||
else if(this.resolved) res(this.value); | ||
else{ | ||
this.rej = rej; | ||
this.res = res; | ||
} | ||
return this.cancel; | ||
}; | ||
export class Action{ | ||
@@ -447,3 +478,3 @@ rejected(x){ this.cancel(); return new Rejected(x) } | ||
constructor(other){ super(); this.other = other } | ||
run(early){ return new RaceActionState(early, this.other) } | ||
run(early){ return new RaceActionState(early, new Eager(this.other)) } | ||
toString(){ return `race(${this.other.toString()})` } | ||
@@ -459,3 +490,3 @@ } | ||
constructor(other){ super(); this.other = other } | ||
run(early){ return new BothActionState(early, this.other) } | ||
run(early){ return new BothActionState(early, new Eager(this.other)) } | ||
resolved(x){ return this.other._map(y => [x, y]) } | ||
@@ -534,3 +565,3 @@ toString(){ return `both(${this.other.toString()})` } | ||
Sequence.prototype._fork = interpretor; | ||
Sequence.prototype._fork = interpreter; | ||
@@ -537,0 +568,0 @@ Sequence.prototype.toString = function Sequence$toString(){ |
Sorry, the diff of this file is too big to display
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
175330
3599