basant307/AI_Governance_Project
048
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 engines15Automatically 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 Chrome22 - 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 function25 - 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## Example31 32```js33var 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## Install58 59Install with60 61```62npm install is-callable63```64 65## Tests66 67Simply clone the repo, `npm install`, and run `npm test`68 69[1]: https://npmjs.org/package/is-callable70[2]: https://versionbadg.es/inspect-js/is-callable.svg71[5]: https://david-dm.org/inspect-js/is-callable.svg72[6]: https://david-dm.org/inspect-js/is-callable73[7]: https://david-dm.org/inspect-js/is-callable/dev-status.svg74[8]: https://david-dm.org/inspect-js/is-callable#info=devDependencies75[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true76[license-image]: https://img.shields.io/npm/l/is-callable.svg77[license-url]: LICENSE78[downloads-image]: https://img.shields.io/npm/dm/is-callable.svg79[downloads-url]: https://npm-stat.com/charts.html?package=is-callable80[codecov-image]: https://codecov.io/gh/inspect-js/is-callable/branch/main/graphs/badge.svg81[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-callable83[actions-url]: https://github.com/inspect-js/is-callable/actions84 