$ npm install is-hybrid
Check whether an object looks like Hybrid which is promises-a+ promise and callback api
npm i is-hybrid --save
npm test
For more use-cases see the tests
var gotPromise = require('got-promise')
var isPromise = require('is-promise')
var gotHybrid = require('then-got')
var isHybrid = require('is-hybrid')
var assert = require('assert')
var hybrid = gotHybrid('http://www.tunnckocore.tk')
var promise = gotPromise('http://www.tunnckocore.tk')
assert(isHybrid(hybrid))
assert(isPromise(hybrid))
assert(isPromise(promise))
assert(!isHybrid(promise))
assert(!isHybrid(null))
assert(!isHybrid('foo'))
assert(!isHybrid(123))
assert(!isHybrid({foo: 'bar'}))
assert(!isHybrid([1, 2, 3, 4]))
assert(!isHybrid(undefined))
assert(!isHybrid(Object))
assert(!isHybrid(Function))
assert(!isHybrid(function () {}))
console.log('tests pass')
//=> tests pass
name
or user/repo
exists in npm registry or in github as user… morekind-of
and in bonus functional api.Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. But before doing anything, please read the CONTRIBUTING.md guidelines.
© 2010 - cnpmjs.org x YWFE | Home | YWFE