ramda-fantasy
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "ramda-fantasy", | ||
"description": "Fantasy Land compatible types for easy integration with Ramda", | ||
"version": "0.3.0", | ||
"version": "0.4.1", | ||
"authors": [ | ||
@@ -6,0 +6,0 @@ { |
@@ -16,3 +16,3 @@ { | ||
"description": "Fantasy Land compatible types for easy integration with Ramda", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"homepage": "https://www.github.com/ramda/ramda-fantasy", | ||
@@ -19,0 +19,0 @@ "license": "MIT", |
@@ -108,3 +108,3 @@ var R = require('ramda'); | ||
Future.memoize = function(f) { | ||
Future.cache = function(f) { | ||
var status = 'IDLE'; | ||
@@ -111,0 +111,0 @@ var listeners = []; |
@@ -41,3 +41,3 @@ var R = require('ramda'); | ||
Reader.ask = Reader(R.always); | ||
Reader.ask = Reader(R.identity); | ||
@@ -44,0 +44,0 @@ Reader.prototype.toString = function() { |
@@ -242,4 +242,4 @@ var R = require('ramda'); | ||
describe('#memoize', function() { | ||
var memoized; | ||
describe('#cache', function() { | ||
var cached; | ||
var throwIfCalledTwice; | ||
@@ -262,7 +262,7 @@ | ||
beforeEach(function() { | ||
memoized = Future.memoize(Future.of(1).map(throwIfCalledTwice)); | ||
cached = Future.cache(Future.of(1).map(throwIfCalledTwice)); | ||
}); | ||
it('can be forked with a resolved value', function(done) { | ||
memoized.fork(done, function(v) { | ||
cached.fork(done, function(v) { | ||
assert.equal(1, v); | ||
@@ -273,5 +273,5 @@ done(); | ||
it('passes on the same value to the memoized future', function(done) { | ||
memoized.fork(done, function() { | ||
memoized.fork(done, function(v) { | ||
it('passes on the same value to the cached future', function(done) { | ||
cached.fork(done, function() { | ||
cached.fork(done, function(v) { | ||
assert.equal(1, v); | ||
@@ -292,3 +292,3 @@ done(); | ||
beforeEach(function() { | ||
memoized = Future.memoize(Future.of(1).map(throwIfCalledTwice).map(throwError)); | ||
cached = Future.cache(Future.of(1).map(throwIfCalledTwice).map(throwError)); | ||
}); | ||
@@ -298,3 +298,3 @@ | ||
var result; | ||
memoized.fork(function(err) { | ||
cached.fork(function(err) { | ||
result = err.message; | ||
@@ -307,4 +307,4 @@ }); | ||
var result; | ||
memoized.fork(function() { | ||
memoized.fork(function(err) { | ||
cached.fork(function() { | ||
cached.fork(function(err) { | ||
result = err.message; | ||
@@ -320,7 +320,7 @@ }); | ||
it('calls all fork resolve functions when the memoized future is resolved', function(done) { | ||
it('calls all fork resolve functions when the cached future is resolved', function(done) { | ||
var delayed = new Future(function(reject, resolve) { | ||
setTimeout(resolve, 5, 'resolvedValue'); | ||
}); | ||
var memoized = Future.memoize(delayed.map(throwIfCalledTwice)); | ||
var cached = Future.cache(delayed.map(throwIfCalledTwice)); | ||
var result1; | ||
@@ -335,7 +335,7 @@ var result2; | ||
} | ||
memoized.fork(done, function(v) { | ||
cached.fork(done, function(v) { | ||
result1 = v; | ||
assertBoth(); | ||
}); | ||
memoized.fork(done, function(v) { | ||
cached.fork(done, function(v) { | ||
result2 = v; | ||
@@ -346,7 +346,7 @@ assertBoth(); | ||
it('calls all fork reject fnctions when the memoized future is rejected', function(done) { | ||
it('calls all fork reject fnctions when the cached future is rejected', function(done) { | ||
var delayed = new Future(function(reject) { | ||
setTimeout(reject, 5, 'rejectedValue'); | ||
}); | ||
var memoized = Future.memoize(delayed.bimap(throwIfCalledTwice, R.identity)); | ||
var cached = Future.cache(delayed.bimap(throwIfCalledTwice, R.identity)); | ||
var result1; | ||
@@ -361,7 +361,7 @@ var result2; | ||
} | ||
memoized.fork(function(e) { | ||
cached.fork(function(e) { | ||
result1 = e; | ||
assertBoth(); | ||
}); | ||
memoized.fork(function(e) { | ||
cached.fork(function(e) { | ||
result2 = e; | ||
@@ -368,0 +368,0 @@ assertBoth(); |
@@ -87,2 +87,9 @@ var assert = require('assert'); | ||
describe('.ask', function() { | ||
it('provides access to the environment', function() { | ||
var r = Reader.ask.map(add(100)); | ||
assert.equal(101, r.run(1)); | ||
}); | ||
}); | ||
describe('#toString', function() { | ||
@@ -89,0 +96,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
106936
41
1740
1