Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-callable

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-callable

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

  • 1.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41M
increased by3.91%
Maintainers
1
Weekly downloads
 
Created

What is is-callable?

The is-callable npm package is used to determine if a value is callable, meaning it can be called as a function. This is useful for type-checking in JavaScript where the typeof operator can be insufficient for certain cases, such as distinguishing between callable and non-callable objects.

What are is-callable's main functionalities?

Check if a value is callable

This feature allows you to check if various types of values are callable, including regular functions, async functions, arrow functions, and classes. It also correctly identifies non-callable objects like regex literals and plain objects.

const isCallable = require('is-callable');

console.log(isCallable(function() {})); // true
console.log(isCallable(async function() {})); // true
console.log(isCallable(() => {})); // true
console.log(isCallable(class MyClass {})); // true
console.log(isCallable(/regex/)); // false
console.log(isCallable(null)); // false
console.log(isCallable({})); // false

Other packages similar to is-callable

Keywords

FAQs

Package last updated on 03 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc