Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

is-callable

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Issues
File Explorer

Advanced tools

is-callable

Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.

    1.2.7latest

Version published
Maintainers
1
Weekly downloads
35,071,910
increased by4.27%

Weekly downloads

Changelog

Source

v1.2.7 - 2022-09-23

Commits

  • [Fix] recognize document.all in IE 6-10 06c1db2
  • [Tests] improve logic for FF 20-35 0f7d9b9
  • [Fix] handle document.all in FF 27 (and +, probably) 696c661
  • [Tests] fix proxy tests in FF 42-63 985df0d
  • [readme] update tested browsers 389e919
  • [Fix] detect document.all in Opera 12.16 b9f1022
  • [Fix] HTML elements: properly report as callable in Opera 12.16 17391fe
  • [Tests] fix inverted logic in FF3 test 056ebd4

Readme

Source

is-callable Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.

Supported engines

Automatically tested in every minor version of node.

Manually tested in:

  • Safari: v4 - v15 (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)
    • 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.
  • Chrome: v15 - v81, v83 - v106(every integer version)
    • Note: This includes Edge v80+ and Opera v15+, which matches Chrome
  • Firefox: v3, v3.6, v4 - v105 (every integer version)
    • 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.
    • Note: in v42 - v63, Function.prototype.toString throws on HTML element constructors, or a Proxy to a function
    • Note: in v20 - v35, HTML element constructors are not callable, despite having typeof function.
    • Note: in v19, document.all is not callable.
  • IE: v6 - v11(every integer version
  • Opera: v11.1, v11.5, v11.6, v12.1, v12.14, v12.15, v12.16, v15+ v15+ matches Chrome

Example

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));

Install

Install with

npm install is-callable

Tests

Simply clone the repo, npm install, and run npm test

Keywords

FAQs

What is is-callable?

Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.

Is is-callable popular?

The npm package is-callable receives a total of 29,567,301 weekly downloads. As such, is-callable popularity was classified as popular.

Is is-callable well maintained?

We found that is-callable demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 23 Sep 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc