or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

index.md
tile.json

index.mddocs/

0

# Lodash isNull

1

2

The lodash isNull function is a utility that checks if a given value is strictly equal to `null`. This function is part of the lodash Lang category and provides a reliable way to test for null values in JavaScript applications.

3

4

## Package Information

5

6

- **Package Name**: lodash

7

- **Package Type**: npm

8

- **Language**: JavaScript

9

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

10

- **Version**: 3.0.0

11

12

## Core Imports

13

14

ESM/ES6 Modules:

15

```javascript

16

import _ from "lodash";

17

```

18

19

CommonJS/Node.js:

20

```javascript

21

const _ = require("lodash");

22

```

23

24

## Basic Usage

25

26

```javascript

27

import _ from "lodash";

28

29

// Check for null value

30

console.log(_.isNull(null)); // => true

31

console.log(_.isNull(undefined)); // => false

32

console.log(_.isNull(0)); // => false

33

console.log(_.isNull("")); // => false

34

console.log(_.isNull(false)); // => false

35

```

36

37

## Capabilities

38

39

### Null Value Detection

40

41

Checks if a value is `null` using strict equality comparison.

42

43

```javascript { .api }

44

/**

45

* Checks if `value` is `null`.

46

*

47

* @static

48

* @memberOf _

49

* @category Lang

50

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

51

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

52

*/

53

function isNull(value);

54

```

55

56

**Usage Examples:**

57

58

```javascript

59

// Basic null checking

60

_.isNull(null);

61

// => true

62

63

_.isNull(void 0); // undefined

64

// => false

65

66

// Testing with various falsy values

67

_.isNull(false);

68

// => false

69

70

_.isNull(0);

71

// => false

72

73

_.isNull("");

74

// => false

75

76

_.isNull(NaN);

77

// => false

78

79

// Testing with objects and arrays

80

_.isNull({});

81

// => false

82

83

_.isNull([]);

84

// => false

85

86

// Testing with functions

87

_.isNull(function() {});

88

// => false

89

```

90

91

**Implementation Details:**

92

93

- Uses strict equality (`===`) comparison with `null`

94

- Returns `true` only for `null` values

95

- Returns `false` for all other values including `undefined`, `0`, `false`, `""`, and `NaN`

96

- Cross-realm compatible - works with null values from different JavaScript contexts

97

- No dependencies on other lodash functions

98

- Optimized for performance with single comparison operation

99

100

**Common Use Cases:**

101

102

- Form validation where null values need to be identified

103

- API response processing where null indicates missing data

104

- Data cleaning operations to identify null values in datasets

105

- Conditional logic where null values require special handling

106

- Type guards in TypeScript when used with type assertions

107

108

**Error Handling:**

109

110

This function does not throw any errors. It safely handles all JavaScript value types including:

111

- Primitive values (string, number, boolean, symbol, bigint)

112

- Object values (objects, arrays, functions, dates, etc.)

113

- Special values (null, undefined, NaN)

114

- Host objects (in browser environments)