or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/npm-lodash--isfunction

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

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/lodash.isfunction@3.0.x

To install, run

npx @tessl/cli install tessl/npm-lodash--isfunction@3.0.0

0

# lodash.isfunction

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: lodash.isfunction

7

- **Package Type**: npm

8

- **Language**: JavaScript

9

- **Installation**: `npm install lodash.isfunction`

10

11

## Core Imports

12

13

CommonJS (primary):

14

15

```javascript

16

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

17

```

18

19

ESM (via interop):

20

21

```javascript

22

import isFunction from "lodash.isfunction";

23

```

24

25

TypeScript:

26

27

```typescript

28

import isFunction from "lodash.isfunction";

29

// Note: No built-in TypeScript definitions. Function returns boolean.

30

```

31

32

## Basic Usage

33

34

```javascript

35

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

36

37

// Regular functions

38

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

39

isFunction(() => {}); // => true

40

41

// Async functions

42

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

43

isFunction(async () => {}); // => true

44

45

// Generator functions

46

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

47

48

// Built-in functions

49

isFunction(Array.prototype.slice); // => true

50

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

51

52

// Non-functions

53

isFunction(/abc/); // => false

54

isFunction({}); // => false

55

isFunction("function"); // => false

56

isFunction(null); // => false

57

isFunction(undefined); // => false

58

```

59

60

## Capabilities

61

62

### Function Detection

63

64

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

65

66

```javascript { .api }

67

/**

68

* Checks if `value` is classified as a `Function` object.

69

*

70

* @param {*} value The value to check.

71

* @returns {boolean} Returns `true` if `value` is a function, else `false`.

72

* @since 0.1.0

73

* @category Lang

74

* @example

75

*

76

* const isFunction = require('lodash.isfunction');

77

*

78

* isFunction(function() {});

79

* // => true

80

*

81

* isFunction(/abc/);

82

* // => false

83

*/

84

function isFunction(value: any): boolean;

85

```

86

87

**Function Types Detected:**

88

- Regular functions (`function() {}`)

89

- Arrow functions (`() => {}`)

90

- Async functions (`async function() {}`, `async () => {}`)

91

- Generator functions (`function* () {}`)

92

- Proxy-wrapped functions

93

- Built-in functions (Array.prototype.slice, console.log, etc.)

94

95

**Implementation Details:**

96

- Uses `Object.prototype.toString` for reliable type detection

97

- Handles `Symbol.toStringTag` for custom objects

98

- Avoids Safari 9 issues with `typeof` operator on typed arrays

99

- Works consistently across different JavaScript environments

100

101

**Browser Compatibility:**

102

- Works in all modern browsers

103

- Compatible with Node.js environments

104

- Handles cross-frame scenarios properly