exalted.future
Advanced tools
Comparing version 0.0.35 to 0.0.36
@@ -294,2 +294,9 @@ var compose = function compose() { | ||
var len = function len() { | ||
var r = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
return r.filter(function (a) { | ||
return a !== undefined; | ||
}).length; | ||
}; | ||
var all = function all(futures) { | ||
@@ -301,8 +308,6 @@ return Future(function (left, right) { | ||
Left: function Left(error) { | ||
return !errored && (errored = true, left(error)); | ||
return errored = true, results[i] = error || 'undefined error', len(results) === len(futures) && left(results); | ||
}, | ||
Right: function Right(result) { | ||
return results[i] = result, !errored && results.filter(function (a) { | ||
return a !== undefined; | ||
}).length === futures.length && right(results); | ||
return results[i] = result, len(results) === len(futures) && (errored ? left(results) : right(results)); | ||
} | ||
@@ -309,0 +314,0 @@ }), results; |
@@ -136,2 +136,4 @@ (function (global, factory) { | ||
const len = (r = []) => r.filter(a => a !== undefined).length; | ||
const all = futures => | ||
@@ -142,8 +144,9 @@ Future((left, right, errored = false) => | ||
future.cata({ | ||
Left: error => !errored && ((errored = true), left(error)), | ||
Left: error => ( | ||
(errored = true), | ||
(results[i] = error || 'undefined error'), | ||
len(results) === len(futures) && left(results)), | ||
Right: result => ( | ||
(results[i] = result), | ||
!errored && | ||
results.filter(a => a !== undefined).length === futures.length && | ||
right(results)) | ||
len(results) === len(futures) && (errored ? left(results) : right(results))) | ||
}), | ||
@@ -150,0 +153,0 @@ results |
{ | ||
"name": "exalted.future", | ||
"version": "0.0.35", | ||
"version": "0.0.36", | ||
"description": "Exalted monadic library & functional fun, fantasy-land compliant, mostly.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/pre63/exalted.future.git", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
51789
1190
0