Sha256: a5a3b64423b7d0913ce1cfa29bd19ea38b7b0ce7c73333e6521bbf21e50a7b25

Contents?: true

Size: 1.93 KB

Versions: 71

Compression:

Stored size: 1.93 KB

Contents

# is-callable <sup>[![Version Badge][2]][1]</sup>

[![Build Status][3]][4]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][11]][1]

[![browser support][9]][10]

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

## Example

```js
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));
```

## Tests
Simply clone the repo, `npm install`, and run `npm test`

[1]: https://npmjs.org/package/is-callable
[2]: http://versionbadg.es/ljharb/is-callable.svg
[3]: https://travis-ci.org/ljharb/is-callable.svg
[4]: https://travis-ci.org/ljharb/is-callable
[5]: https://david-dm.org/ljharb/is-callable.svg
[6]: https://david-dm.org/ljharb/is-callable
[7]: https://david-dm.org/ljharb/is-callable/dev-status.svg
[8]: https://david-dm.org/ljharb/is-callable#info=devDependencies
[9]: https://ci.testling.com/ljharb/is-callable.png
[10]: https://ci.testling.com/ljharb/is-callable
[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/is-callable.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/is-callable.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is-callable

Version data entries

71 entries across 71 versions & 12 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/is-callable/README.md
disco_app-0.18.2 test/dummy/node_modules/is-callable/README.md
disco_app-0.16.1 test/dummy/node_modules/is-callable/README.md
disco_app-0.15.2 test/dummy/node_modules/is-callable/README.md
disco_app-0.18.4 test/dummy/node_modules/is-callable/README.md
disco_app-0.18.1 test/dummy/node_modules/is-callable/README.md
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/is-callable/README.md
disco_app-0.14.0 test/dummy/node_modules/is-callable/README.md
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/is-callable/README.md
enju_library-0.3.8 spec/dummy/node_modules/is-callable/README.md
ilog-0.4.1 node_modules/is-callable/README.md
ilog-0.4.0 node_modules/is-callable/README.md
ilog-0.3.3 node_modules/is-callable/README.md
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/is-callable/README.md
jester-data-8.0.0 node_modules/is-callable/README.md
ezii-os-5.2.1 node_modules/is-callable/README.md
ezii-os-2.0.1 node_modules/is-callable/README.md
ezii-os-1.1.0 node_modules/is-callable/README.md
ezii-os-1.0.0 node_modules/is-callable/README.md
ezii-os-0.0.0.1.0 node_modules/is-callable/README.md