or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

collection-validation.mdconfiguration.mddate-time.mdenvironment-detection.mdindex.mdnumeric-operations.mdpattern-matching.mdpresence-checking.mdstring-checking.mdtype-checking.md
tile.json

presence-checking.mddocs/

0

# Presence Checking

1

2

Functions for checking value existence, truthiness, and basic state validation.

3

4

## Capabilities

5

6

### Empty Check

7

8

Checks if the given value is empty (works with objects, arrays, and strings).

9

10

```javascript { .api }

11

/**

12

* Checks if the given value is empty

13

* @param value - Value to check (array, object, or string)

14

* @returns True if value is empty

15

* Interfaces: not, all, any

16

*/

17

function empty(value: any): boolean;

18

```

19

20

**Usage Example:**

21

22

```javascript

23

is.empty({}); // true

24

is.empty([]); // true

25

is.empty(''); // true

26

is.not.empty(['foo']); // true

27

is.all.empty('', {}, ['foo']); // false

28

is.any.empty([], 42); // true

29

```

30

31

### Existy Check

32

33

Checks if the given value is existy (not null or undefined).

34

35

```javascript { .api }

36

/**

37

* Checks if the given value is existy (not null or undefined)

38

* @param value - Value to check

39

* @returns True if value is not null or undefined

40

* Interfaces: not, all, any

41

*/

42

function existy(value: any): boolean;

43

```

44

45

**Usage Example:**

46

47

```javascript

48

is.existy({}); // true

49

is.existy(null); // false

50

is.not.existy(undefined); // true

51

is.all.existy(null, ['foo']); // false

52

is.any.existy(undefined, 42); // true

53

```

54

55

### Falsy Check

56

57

Checks if the given value is falsy.

58

59

```javascript { .api }

60

/**

61

* Checks if the given value is falsy

62

* @param value - Value to check

63

* @returns True if value is falsy

64

* Interfaces: not, all, any

65

*/

66

function falsy(value: any): boolean;

67

```

68

69

**Usage Example:**

70

71

```javascript

72

is.falsy(false); // true

73

is.falsy(null); // true

74

is.not.falsy(true); // true

75

is.all.falsy(null, false); // true

76

is.any.falsy(undefined, true); // true

77

```

78

79

### Truthy Check

80

81

Checks if the given value is truthy (existy and not false).

82

83

```javascript { .api }

84

/**

85

* Checks if the given value is truthy

86

* @param value - Value to check

87

* @returns True if value is truthy

88

* Interfaces: not, all, any

89

*/

90

function truthy(value: any): boolean;

91

```

92

93

**Usage Example:**

94

95

```javascript

96

is.truthy(true); // true

97

is.truthy(null); // false

98

is.not.truthy(false); // true

99

is.all.truthy(null, true); // false

100

is.any.truthy(undefined, true); // true

101

```

102

103

### Space Check

104

105

Checks if the given value is a whitespace character.

106

107

```javascript { .api }

108

/**

109

* Checks if the given value is space

110

* @param value - Value to check

111

* @returns True if value is whitespace character

112

* Interfaces: not, all, any

113

*/

114

function space(value: any): boolean;

115

```

116

117

**Usage Example:**

118

119

```javascript

120

is.space(' '); // true

121

is.space('foo'); // false

122

is.not.space(true); // true

123

is.all.space(' ', 'foo'); // false

124

is.any.space(' ', true); // true

125

```