is-callable
Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.
Last updated 16 hours ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-callable 
SYNC missed versions from official npm registry.

is-callable Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

browser support

Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.

Example

var isCallable = require('is-callable');
var assert = require('assert');

assert.notOk(isCallable(undefined));
assert.notOk(isCallable(null));
assert.notOk(isCallable(false));
assert.notOk(isCallable(true));
assert.notOk(isCallable([]));
assert.notOk(isCallable({}));
assert.notOk(isCallable(/a/g));
assert.notOk(isCallable(new RegExp('a', 'g')));
assert.notOk(isCallable(new Date()));
assert.notOk(isCallable(42));
assert.notOk(isCallable(NaN));
assert.notOk(isCallable(Infinity));
assert.notOk(isCallable(new Number(42)));
assert.notOk(isCallable('foo'));
assert.notOk(isCallable(Object('foo')));

assert.ok(isCallable(function () {}));
assert.ok(isCallable(function* () {}));
assert.ok(isCallable(x => x * x));

Install

Install with

npm install is-callable

Tests

Simply clone the repo, npm install, and run npm test

Current Tags

  • 1.2.2                                ...           latest (16 hours ago)

13 Versions

  • 1.2.2                                ...           16 hours ago
  • 1.2.1                                ...           13 days ago
  • 1.2.0                                ...           4 months ago
  • 1.1.5                                ...           9 months ago
  • 1.1.4                                ...           2 years ago
  • 1.1.3                                ...           5 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.4                                ...           6 years ago
  • 1.0.3                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 76,279
This Week 135,782
This Month 1,013,682
Last Day 59,503
Last Week 350,579
Last Month 1,111,517
Dependencies (0)
None
Dev Dependencies (14)
Dependents (94)

Copyright 2014 - 2017 © taobao.org |