CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-lodash-isfunction

The Lodash method isFunction exported as a module for checking if a value is classified as a Function object.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

index.mddocs/

lodash.isfunction

The Lodash method _.isFunction exported as a standalone module for checking if a value is classified as a Function object. This utility provides robust function detection that handles modern JavaScript function types including regular functions, async functions, generator functions, and proxy-wrapped functions while properly handling edge cases and cross-environment compatibility.

Package Information

  • Package Name: lodash.isfunction
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install lodash.isfunction

Core Imports

CommonJS (primary):

const isFunction = require("lodash.isfunction");

ESM (via interop):

import isFunction from "lodash.isfunction";

TypeScript:

import isFunction from "lodash.isfunction";
// Note: No built-in TypeScript definitions. Function returns boolean.

Basic Usage

const isFunction = require("lodash.isfunction");

// Regular functions
isFunction(function() {});           // => true
isFunction(() => {});                // => true

// Async functions
isFunction(async function() {});     // => true
isFunction(async () => {});          // => true

// Generator functions
isFunction(function* () {});         // => true

// Built-in functions
isFunction(Array.prototype.slice);   // => true
isFunction(console.log);             // => true

// Non-functions
isFunction(/abc/);                   // => false
isFunction({});                      // => false
isFunction("function");              // => false
isFunction(null);                    // => false
isFunction(undefined);               // => false

Capabilities

Function Detection

Checks if a value is classified as a Function object using robust type detection that works across different JavaScript environments.

/**
 * Checks if `value` is classified as a `Function` object.
 *
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
 * @since 0.1.0
 * @category Lang
 * @example
 *
 * const isFunction = require('lodash.isfunction');
 * 
 * isFunction(function() {});
 * // => true
 *
 * isFunction(/abc/);
 * // => false
 */
function isFunction(value: any): boolean;

Function Types Detected:

  • Regular functions (function() {})
  • Arrow functions (() => {})
  • Async functions (async function() {}, async () => {})
  • Generator functions (function* () {})
  • Proxy-wrapped functions
  • Built-in functions (Array.prototype.slice, console.log, etc.)

Implementation Details:

  • Uses Object.prototype.toString for reliable type detection
  • Handles Symbol.toStringTag for custom objects
  • Avoids Safari 9 issues with typeof operator on typed arrays
  • Works consistently across different JavaScript environments

Browser Compatibility:

  • Works in all modern browsers
  • Compatible with Node.js environments
  • Handles cross-frame scenarios properly

docs

index.md

tile.json