Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
.editorconfig | D | 12-May-2024 | 286 | 21 | 16 | |
.istanbul.yml | D | 12-May-2024 | 993 | 48 | 47 | |
.jscs.json | D | 12-May-2024 | 4 KiB | 177 | 114 | |
.travis.yml | D | 12-May-2024 | 6.6 KiB | 226 | 225 | |
CHANGELOG.md | D | 12-May-2024 | 2 KiB | 57 | 47 | |
LICENSE | D | 12-May-2024 | 1.1 KiB | 23 | 17 | |
Makefile | D | 12-May-2024 | 3.7 KiB | 62 | 40 | |
README.md | D | 12-May-2024 | 1.9 KiB | 60 | 49 | |
index.js | D | 12-May-2024 | 1.1 KiB | 38 | 33 | |
package.json | D | 12-May-2024 | 2.9 KiB | 98 | 97 | |
test.js | D | 12-May-2024 | 5.4 KiB | 159 | 131 |
README.md
1# is-callable <sup>[![Version Badge][2]][1]</sup> 2 3[![Build Status][3]][4] 4[![dependency status][5]][6] 5[![dev dependency status][7]][8] 6[![License][license-image]][license-url] 7[![Downloads][downloads-image]][downloads-url] 8 9[![npm badge][11]][1] 10 11[![browser support][9]][10] 12 13Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag. 14 15## Example 16 17```js 18var isCallable = require('is-callable'); 19var assert = require('assert'); 20 21assert.notOk(isCallable(undefined)); 22assert.notOk(isCallable(null)); 23assert.notOk(isCallable(false)); 24assert.notOk(isCallable(true)); 25assert.notOk(isCallable([])); 26assert.notOk(isCallable({})); 27assert.notOk(isCallable(/a/g)); 28assert.notOk(isCallable(new RegExp('a', 'g'))); 29assert.notOk(isCallable(new Date())); 30assert.notOk(isCallable(42)); 31assert.notOk(isCallable(NaN)); 32assert.notOk(isCallable(Infinity)); 33assert.notOk(isCallable(new Number(42))); 34assert.notOk(isCallable('foo')); 35assert.notOk(isCallable(Object('foo'))); 36 37assert.ok(isCallable(function () {})); 38assert.ok(isCallable(function* () {})); 39assert.ok(isCallable(x => x * x)); 40``` 41 42## Tests 43Simply clone the repo, `npm install`, and run `npm test` 44 45[1]: https://npmjs.org/package/is-callable 46[2]: http://versionbadg.es/ljharb/is-callable.svg 47[3]: https://travis-ci.org/ljharb/is-callable.svg 48[4]: https://travis-ci.org/ljharb/is-callable 49[5]: https://david-dm.org/ljharb/is-callable.svg 50[6]: https://david-dm.org/ljharb/is-callable 51[7]: https://david-dm.org/ljharb/is-callable/dev-status.svg 52[8]: https://david-dm.org/ljharb/is-callable#info=devDependencies 53[9]: https://ci.testling.com/ljharb/is-callable.png 54[10]: https://ci.testling.com/ljharb/is-callable 55[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true 56[license-image]: http://img.shields.io/npm/l/is-callable.svg 57[license-url]: LICENSE 58[downloads-image]: http://img.shields.io/npm/dm/is-callable.svg 59[downloads-url]: http://npm-stat.com/charts.html?package=is-callable 60