Comparing version 6.0.1 to 6.1.0
@@ -591,3 +591,3 @@ var abbott = require('abbott'); | ||
return righto(function(done){ | ||
task(function(){ | ||
righto.from(task)(function(){ | ||
done(null, slice(arguments)); | ||
@@ -602,3 +602,3 @@ }); | ||
if(!error){ | ||
return task(done); | ||
return done.apply(null, arguments); | ||
} | ||
@@ -608,3 +608,3 @@ | ||
} | ||
task(complete); | ||
righto.from(task)(complete); | ||
}, handler); | ||
@@ -611,0 +611,0 @@ }; |
{ | ||
"name": "righto", | ||
"version": "6.0.1", | ||
"version": "6.1.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -8,2 +8,4 @@ <h1 align="center">Righto<h1> | ||
![build status](https://travis-ci.org/KoryNunn/righto.svg?branch=master) | ||
An Eventuals implementation that: | ||
@@ -10,0 +12,0 @@ - Lets you use synchronous functions, err-backs (normal callback style), promises, iterators (yield), whatever you like. |
@@ -427,2 +427,15 @@ var test = require('tape'), | ||
test('righto.reduce fail part way', function(t){ | ||
t.plan(3); | ||
var result = righto.reduce([1, 2, 3], function(result, next){ | ||
t.pass(); | ||
return result === 2 ? righto.fail('error') : next; | ||
}); | ||
result(function(error, finalResult){ | ||
t.equal(error, 'error'); | ||
}); | ||
}); | ||
test('righto().get(key)', function(t){ | ||
@@ -681,2 +694,25 @@ t.plan(4); | ||
test('surely promises', function(t){ | ||
t.plan(6); | ||
var errorOrA = righto.surely(new Promise(function(resolve, reject){ | ||
resolve('a') | ||
})); | ||
var errorOrB = righto.surely(new Promise(function(resolve, reject){ | ||
reject('error') | ||
})); | ||
righto(function([aError, a], [bError, b]){ | ||
t.ok(a); | ||
t.notOk(aError); | ||
t.ok(bError); | ||
t.notOk(b); | ||
t.equal(a, 'a'); | ||
t.equal(bError, 'error'); | ||
}, errorOrA, errorOrB)(); | ||
}); | ||
test('0 results resolve 1 argument as a dep', function(t){ | ||
@@ -1334,2 +1370,19 @@ t.plan(2); | ||
test('handle promise', function(t){ | ||
t.plan(1); | ||
var promise = new Promise(function(resolve, reject) { | ||
reject('my error') | ||
}) | ||
function handleError(error, done){ | ||
t.equal(error, 'my error', 'Handled expected error') | ||
done() | ||
} | ||
var handled = righto.handle(promise, handleError); | ||
handled(); | ||
}); | ||
test('generators with handle success', function(t){ | ||
@@ -1336,0 +1389,0 @@ t.plan(2); |
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
77649
19
1913
797