or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

index.md
tile.json

index.mddocs/

0

# lodash.isfinite

1

2

The lodash method `_.isFinite` exported as a standalone module for checking if a value is a finite primitive number. This module provides a more strict implementation than JavaScript's native `isFinite` function by ensuring the value is actually a number type before checking finiteness.

3

4

## Package Information

5

6

- **Package Name**: lodash.isfinite

7

- **Package Type**: npm

8

- **Language**: JavaScript

9

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

10

11

## Core Imports

12

13

```javascript

14

var isFinite = require('lodash.isfinite');

15

```

16

17

For modern JavaScript environments:

18

```javascript

19

const isFinite = require('lodash.isfinite');

20

```

21

22

**Note:** This is a CommonJS module and does not support ESM (import/export) syntax. For ESM environments, use dynamic imports:

23

```javascript

24

const isFinite = (await import('lodash.isfinite')).default;

25

```

26

27

## Basic Usage

28

29

```javascript

30

var isFinite = require('lodash.isfinite');

31

32

// Finite numbers

33

isFinite(3);

34

// => true

35

36

isFinite(Number.MIN_VALUE);

37

// => true

38

39

isFinite(-1000.5);

40

// => true

41

42

// Non-finite numbers

43

isFinite(Infinity);

44

// => false

45

46

isFinite(-Infinity);

47

// => false

48

49

isFinite(NaN);

50

// => false

51

52

// Non-numbers (key difference from native isFinite)

53

isFinite('3');

54

// => false (native isFinite would return true)

55

56

isFinite(null);

57

// => false (native isFinite would return true)

58

59

isFinite(undefined);

60

// => false

61

```

62

63

## Capabilities

64

65

### isFinite Function

66

67

Checks if a value is a finite primitive number. Unlike JavaScript's native `isFinite` function, this method does not coerce values to numbers and returns `false` for non-number types.

68

69

```javascript { .api }

70

/**

71

* Checks if `value` is a finite primitive number.

72

*

73

* Note: This method is based on Number.isFinite.

74

*

75

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

76

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

77

* @since 0.1.0

78

* @category Lang

79

*/

80

function isFinite(value);

81

```

82

83

**Key Behavior:**

84

- Returns `true` only for values that are both of type `number` AND finite

85

- Returns `false` for `Infinity`, `-Infinity`, and `NaN`

86

- Returns `false` for all non-number types including string numbers like `'3'`

87

- More strict than native `isFinite` which coerces values to numbers first

88

89

**Common Use Cases:**

90

- Validating numeric input before mathematical operations

91

- Checking if a calculated result is a valid finite number

92

- Input sanitization where only actual numbers should be accepted

93

- Data validation in forms or APIs where strict number validation is required