is-hybrid
Check whether an object looks like Hybrid which is promises-a+ promise and callback api
Last updated 10 years ago by tunnckocore .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install is-hybrid 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.1                                ...           latest (9 years ago)

3 Versions

  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           10 years ago
  • 0.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE