🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@stdlib/assert-is-function

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/assert-is-function

Test if a value is a function.

0.2.2
latest
Source
npm
Version published
Weekly downloads
371K
-9.67%
Maintainers
4
Weekly downloads
 
Created

What is @stdlib/assert-is-function?

@stdlib/assert-is-function is a utility package that provides functionality to check if a value is a function. This can be useful in various scenarios where type checking is necessary to ensure that a value can be invoked as a function.

What are @stdlib/assert-is-function's main functionalities?

Basic Function Check

This feature allows you to check if a given value is a function. It returns `true` if the value is a function and `false` otherwise.

const isFunction = require('@stdlib/assert-is-function');

console.log(isFunction(function() {})); // true
console.log(isFunction(null)); // false

Arrow Function Check

This feature supports checking if an arrow function is a function. It returns `true` for arrow functions.

const isFunction = require('@stdlib/assert-is-function');

console.log(isFunction(() => {})); // true

Class Method Check

This feature allows you to check if a class method is a function. It returns `true` for class methods.

const isFunction = require('@stdlib/assert-is-function');

class MyClass {
  myMethod() {}
}

console.log(isFunction(MyClass.prototype.myMethod)); // true

Other packages similar to @stdlib/assert-is-function

Keywords

stdlib

FAQs

Package last updated on 27 Jul 2024

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