Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 16-Feb-2021 | - | ||||
.github/ | H | 16-Feb-2021 | - | 44 | 34 | |
test/ | H | 03-May-2022 | - | |||
.editorconfig | H A D | 16-Feb-2021 | 286 | 21 | 16 | |
.eslintrc | H A D | 16-Feb-2021 | 153 | 12 | 9 | |
.istanbul.yml | H A D | 16-Feb-2021 | 993 | 48 | 47 | |
.travis.yml | H A D | 16-Feb-2021 | 252 | 13 | 12 | |
CHANGELOG.md | H A D | 16-Feb-2021 | 2.4 KiB | 68 | 57 | |
LICENSE | H A D | 16-Feb-2021 | 1.1 KiB | 23 | 17 | |
README.md | H A D | 16-Feb-2021 | 1.9 KiB | 60 | 49 | |
package.json | H A D | 16-Feb-2021 | 2.7 KiB | 92 | 91 |
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