is-callable
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The "is-callable" is a highly useful JavaScript utility function that allows users to determine if a JavaScript value is callable. It's efficient at recognizing Function and GeneratorFunction types, contrary to the ES6 @@toStringTag. Its functionality stands out due to its extensive testing and support across various engines, ranging from different versions of Safari, Chrome, Firefox, Internet Explorer, and Opera.
To use "is-callable", you'll first need to install it via npm, using the command npm install is-callable
. Once installed, you can use "is-callable" by requiring it in your JavaScript files and using it to test JavaScript values. Below is a sample code usage:
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));
The "is-callable" npm package's documentation can be found directly on its GitHub page. It provides a comprehensive overview, including description, install instructions, supported engines, and usage examples. The readme file on GitHub is the primary source of documentation, offering all necessary information for users.