promise.pipe
Advanced tools
Comparing version 1.0.1 to 1.0.2
module.exports = pipe | ||
function pipe () { | ||
var args = [].slice.apply(arguments) | ||
if (!arguments.length) throw new Error('pipe requires one or more arguments') | ||
var args = Array.isArray(arguments[0]) | ||
? arguments[0] | ||
: [].slice.apply(arguments) | ||
return reduce(kestrel, args[0], rest(args)) | ||
@@ -7,0 +10,0 @@ } |
{ | ||
"name": "promise.pipe", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Performs left to right composition of one or more functions whom return promises", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -26,3 +26,3 @@ # promise-pipe | ||
#### `pipe(functions...)` -> `promise` | ||
#### `pipe(Array<Function<Promise>>, or Function<Promise>)` -> `promise` | ||
@@ -29,0 +29,0 @@ Runs multiple promise-returning functions in a series, passing each result to the next defined promise-returning function. |
@@ -73,2 +73,11 @@ var test = require('blue-tape') | ||
test('it should accept an array of promises', function (t) { | ||
var addThreeAsync = pipe([addAsync, addAsync, addAsync]) | ||
t.ok(addThreeAsync) | ||
return addThreeAsync(0).then(function (result) { | ||
t.equal(result, 3) | ||
}) | ||
}) | ||
test('it should fail with 0 arguments', function (t) { | ||
@@ -75,0 +84,0 @@ try { pipe() } catch (err) { |
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
4290
93