Home

Awesome

is-hybrid npmjs.com The MIT License

Check whether an object looks like Hybrid which is promises-a+ promise and callback api

code climate standard code style travis build status coverage status dependency status

Install

npm i is-hybrid --save
npm test

Usage

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

See also

Contributing

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.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github