Comparing version 2.1.2 to 2.2.0
@@ -473,2 +473,6 @@ var abbott = require('abbott'); | ||
righto.isRighto = isRighto; | ||
righto.isThenable = isThenable; | ||
righto.isResolveable = isResolveable; | ||
righto.proxy = function(){ | ||
@@ -475,0 +479,0 @@ if(typeof Proxy === 'undefined'){ |
{ | ||
"name": "righto", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -521,2 +521,25 @@ # Righto | ||
## isRighto, isThenable, isResolveable | ||
Use these methods to check if something is a righto, a thenable, or resolveable (either righto or thenable); | ||
``` | ||
var rigthoA = righto(function(done){ | ||
done(null, 1); | ||
}); | ||
var promiseB = new Promise(function(resolve, reject){ | ||
resolve(null, 2); | ||
}); | ||
righto.isRighto(rigthoA); -> true | ||
righto.isRighto(promiseB); -> false | ||
righto.isThenable(rigthoA); -> false | ||
righto.isThenable(promiseB); -> true | ||
righto.isResolveable(rigthoA); -> true | ||
righto.isResolveable(promiseB); -> true | ||
``` | ||
# Tracing | ||
@@ -523,0 +546,0 @@ |
@@ -1204,2 +1204,24 @@ var test = require('tape'), | ||
}); | ||
}); | ||
test('isRighto', function(t){ | ||
t.plan(9); | ||
var rigthoA = righto(function(done){ | ||
done(null, 1); | ||
}); | ||
var promiseB = new Promise(function(resolve, reject){ | ||
resolve(null, 2); | ||
}); | ||
t.ok(righto.isRighto(rigthoA), 'rigthoA is righto'); | ||
t.notOk(righto.isRighto(promiseB), 'promiseB is not a righto'); | ||
t.notOk(righto.isThenable(rigthoA), 'rigthoA is not a thenable'); | ||
t.ok(righto.isThenable(promiseB), 'promiseB is thenable'); | ||
t.ok(righto.isResolveable(rigthoA), 'rigthoA is resolveable'); | ||
t.ok(righto.isResolveable(promiseB), 'promiseB is resolveable'); | ||
t.notOk(righto.isRighto(null), 'null is not a righto'); | ||
t.notOk(righto.isThenable(null), 'null is not a thenable'); | ||
t.notOk(righto.isResolveable(null), 'null is not a resolveable'); | ||
}); |
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
54909
1418
619