is-hybrid

1.0.1 • Public • Published

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

  • hybridify: Building hybrid APIs. You can use both callback and promise in same time. Like… more
  • is-missing: Check that given name or user/repo exists in npm registry or in github as user… more
  • is-installed: Checks that given package is installed on the system - globally or locally.
  • is-promise: Test whether an object looks like a promises-a+ promise
  • is-generator: Check whether a value is a generator or generator function
  • is-kindof: Thin wrapper around kind-of and in bonus functional api.
  • thenify: Promisify a callback-based function

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

Package Sidebar

Install

npm i is-hybrid

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • vanchoy
  • tunnckocore