source: imaps-frontend/node_modules/is-callable/README.md@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.5 KB
Line 
1# is-callable <sup>[![Version Badge][2]][1]</sup>
2
3[![github actions][actions-image]][actions-url]
4[![coverage][codecov-image]][codecov-url]
5[![dependency status][5]][6]
6[![dev dependency status][7]][8]
7[![License][license-image]][license-url]
8[![Downloads][downloads-image]][downloads-url]
9
10[![npm badge][11]][1]
11
12Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.
13
14## Supported engines
15Automatically tested in every minor version of node.
16
17Manually tested in:
18 - Safari: v4 - v15 <sub>(4, 5, 5.1, 6.0.5, 6.2, 7.1, 8, 9.1.3, 10.1.2, 11.1.2, 12.1, 13.1.2, 14.1.2, 15.3, 15.6.1)</sub>
19 - Note: Safari 9 has `class`, but `Function.prototype.toString` hides that progeny and makes them look like functions, so `class` constructors will be reported by this package as callable, when they are not in fact callable.
20 - Chrome: v15 - v81, v83 - v106<sub>(every integer version)</sub>
21 - Note: This includes Edge v80+ and Opera v15+, which matches Chrome
22 - Firefox: v3, v3.6, v4 - v105 <sub>(every integer version)</sub>
23 - Note: v45 - v54 has `class`, but `Function.prototype.toString` hides that progeny and makes them look like functions, so `class` constructors will be reported by this package as callable, when they are not in fact callable.
24 - Note: in v42 - v63, `Function.prototype.toString` throws on HTML element constructors, or a Proxy to a function
25 - Note: in v20 - v35, HTML element constructors are not callable, despite having typeof `function`.
26 - Note: in v19, `document.all` is not callable.
27 - IE: v6 - v11<sub>(every integer version</sub>
28 - Opera: v11.1, v11.5, v11.6, v12.1, v12.14, v12.15, v12.16, v15+ <sub>v15+ matches Chrome</sub>
29
30## Example
31
32```js
33var isCallable = require('is-callable');
34var assert = require('assert');
35
36assert.notOk(isCallable(undefined));
37assert.notOk(isCallable(null));
38assert.notOk(isCallable(false));
39assert.notOk(isCallable(true));
40assert.notOk(isCallable([]));
41assert.notOk(isCallable({}));
42assert.notOk(isCallable(/a/g));
43assert.notOk(isCallable(new RegExp('a', 'g')));
44assert.notOk(isCallable(new Date()));
45assert.notOk(isCallable(42));
46assert.notOk(isCallable(NaN));
47assert.notOk(isCallable(Infinity));
48assert.notOk(isCallable(new Number(42)));
49assert.notOk(isCallable('foo'));
50assert.notOk(isCallable(Object('foo')));
51
52assert.ok(isCallable(function () {}));
53assert.ok(isCallable(function* () {}));
54assert.ok(isCallable(x => x * x));
55```
56
57## Install
58
59Install with
60
61```
62npm install is-callable
63```
64
65## Tests
66
67Simply clone the repo, `npm install`, and run `npm test`
68
69[1]: https://npmjs.org/package/is-callable
70[2]: https://versionbadg.es/inspect-js/is-callable.svg
71[5]: https://david-dm.org/inspect-js/is-callable.svg
72[6]: https://david-dm.org/inspect-js/is-callable
73[7]: https://david-dm.org/inspect-js/is-callable/dev-status.svg
74[8]: https://david-dm.org/inspect-js/is-callable#info=devDependencies
75[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true
76[license-image]: https://img.shields.io/npm/l/is-callable.svg
77[license-url]: LICENSE
78[downloads-image]: https://img.shields.io/npm/dm/is-callable.svg
79[downloads-url]: https://npm-stat.com/charts.html?package=is-callable
80[codecov-image]: https://codecov.io/gh/inspect-js/is-callable/branch/main/graphs/badge.svg
81[codecov-url]: https://app.codecov.io/gh/inspect-js/is-callable/
82[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-callable
83[actions-url]: https://github.com/inspect-js/is-callable/actions
Note: See TracBrowser for help on using the repository browser.