@rickosborne/guard 2024.12.28 → 2024.12.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -14
- package/package.json +3 -2
- package/functions/assertDefined.md +0 -31
- package/functions/assertInt.md +0 -27
- package/functions/errorFromMessageOrError.md +0 -30
- package/functions/expectInt.md +0 -27
- package/functions/hasArray.md +0 -77
- package/functions/hasNumber.md +0 -31
- package/functions/hasOwn.md +0 -65
- package/functions/isInt.md +0 -23
- package/functions/isListOf.md +0 -31
- package/functions/isObject.md +0 -23
- package/functions/isPlainObject.md +0 -23
- package/functions/isUnaryPredicate.md +0 -28
- package/type-aliases/MessageOrError.md +0 -15
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
**@rickosborne/guard v2024.12.
|
|
1
|
+
**@rickosborne/guard v2024.12.30**
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -8,19 +8,113 @@ Basic type guards building on [@rickosborne/typical](https://www.npmjs.com/packa
|
|
|
8
8
|
|
|
9
9
|
## Type Aliases
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### MessageOrError
|
|
12
|
+
|
|
13
|
+
> **MessageOrError**: string \| Error \| () => string \| Error
|
|
14
|
+
|
|
15
|
+
A message, an error, or something which can generate one of those.
|
|
12
16
|
|
|
13
17
|
## Functions
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
> **assertDefined**\<T\>(value, messageOrError): asserts value is NonNullable<T>
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
> **assertInt**(value, messageOrError): asserts value is number
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
> **errorFromMessageOrError**(messageOrError, defaultConstructor): Error
|
|
28
|
+
|
|
29
|
+
Helper for guards which expect text or an error, or
|
|
30
|
+
can generate one when needed.
|
|
31
|
+
|
|
32
|
+
***
|
|
33
|
+
|
|
34
|
+
> **expectInt**(obj, messageOrError): number
|
|
35
|
+
|
|
36
|
+
***
|
|
37
|
+
|
|
38
|
+
### hasArray()
|
|
39
|
+
|
|
40
|
+
Guard for whether the given value is an object which has a property with its own array value.
|
|
41
|
+
|
|
42
|
+
#### Call Signature
|
|
43
|
+
|
|
44
|
+
> **hasArray**\<Name\>(obj, name, predicate?): obj is { [K in string]: unknown[] }
|
|
45
|
+
|
|
46
|
+
Guard for whether the given value is an object which has a property with its own array value.
|
|
47
|
+
This variant does not exhaustively check the items of the array.
|
|
48
|
+
|
|
49
|
+
##### Type Parameters
|
|
50
|
+
|
|
51
|
+
• **Name** *extends* `string`
|
|
52
|
+
|
|
53
|
+
#### Call Signature
|
|
54
|
+
|
|
55
|
+
> **hasArray**\<Name, Item\>(obj, name, predicate?): obj is { [K in string]: Item[] }
|
|
56
|
+
|
|
57
|
+
Guard for whether the given value is an object which has a property with its own array value.
|
|
58
|
+
This variant exhaustively checks the items of the array against the given predicate.
|
|
59
|
+
|
|
60
|
+
##### Type Parameters
|
|
61
|
+
|
|
62
|
+
• **Name** *extends* `string`
|
|
63
|
+
|
|
64
|
+
• **Item**
|
|
65
|
+
|
|
66
|
+
***
|
|
67
|
+
|
|
68
|
+
> **hasNumber**\<Name\>(obj, name): obj is { [k in string]: string }
|
|
69
|
+
|
|
70
|
+
#### Type Parameters
|
|
71
|
+
|
|
72
|
+
• **Name** *extends* `string`
|
|
73
|
+
|
|
74
|
+
***
|
|
75
|
+
|
|
76
|
+
### hasOwn()
|
|
77
|
+
|
|
78
|
+
#### Call Signature
|
|
79
|
+
|
|
80
|
+
> **hasOwn**\<Name\>(obj, name): obj is { [K in string]: unknown }
|
|
81
|
+
|
|
82
|
+
##### Type Parameters
|
|
83
|
+
|
|
84
|
+
• **Name** *extends* `string`
|
|
85
|
+
|
|
86
|
+
#### Call Signature
|
|
87
|
+
|
|
88
|
+
> **hasOwn**\<Name, T\>(obj, name, predicate): obj is { [K in string]: T }
|
|
89
|
+
|
|
90
|
+
##### Type Parameters
|
|
91
|
+
|
|
92
|
+
• **Name** *extends* `string`
|
|
93
|
+
|
|
94
|
+
• **T**
|
|
95
|
+
|
|
96
|
+
***
|
|
97
|
+
|
|
98
|
+
> **isInt**(obj): obj is number
|
|
99
|
+
|
|
100
|
+
***
|
|
101
|
+
|
|
102
|
+
> **isListOf**\<T\>(list, predicate): list is T[]
|
|
103
|
+
|
|
104
|
+
***
|
|
105
|
+
|
|
106
|
+
> **isObject**(obj): obj is object
|
|
107
|
+
|
|
108
|
+
***
|
|
109
|
+
|
|
110
|
+
> **isPlainObject**(obj): obj is Record<never, never>
|
|
111
|
+
|
|
112
|
+
***
|
|
113
|
+
|
|
114
|
+
> **isUnaryPredicate**(obj): obj is UnaryPredicate<unknown>
|
|
115
|
+
|
|
116
|
+
Tests whether the given object is a function and takes at
|
|
117
|
+
least one parameter, and could maybe act as a unary predicate.
|
|
118
|
+
Warning! Since no type information is available at runtime,
|
|
119
|
+
it may not actually act as a predicate!
|
|
120
|
+
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://rickosborne.org"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@rickosborne/typical": "2024.12.
|
|
7
|
+
"@rickosborne/typical": "2024.12.30"
|
|
8
8
|
},
|
|
9
9
|
"description": "Rick Osborne's collection of type guards.",
|
|
10
10
|
"engines": {
|
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
|
+
"directory": "guard",
|
|
30
31
|
"type": "git",
|
|
31
32
|
"url": "git+https://github.com/rickosborne/es-js-ts.git"
|
|
32
33
|
},
|
|
33
|
-
"version": "2024.12.
|
|
34
|
+
"version": "2024.12.30"
|
|
34
35
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / assertDefined
|
|
6
|
-
|
|
7
|
-
# Function: assertDefined()
|
|
8
|
-
|
|
9
|
-
> **assertDefined**\<`T`\>(`value`, `messageOrError`): `asserts value is NonNullable<T>`
|
|
10
|
-
|
|
11
|
-
## Type Parameters
|
|
12
|
-
|
|
13
|
-
• **T**
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
### value
|
|
18
|
-
|
|
19
|
-
`T`
|
|
20
|
-
|
|
21
|
-
### messageOrError
|
|
22
|
-
|
|
23
|
-
[`MessageOrError`](../type-aliases/MessageOrError.md)
|
|
24
|
-
|
|
25
|
-
## Returns
|
|
26
|
-
|
|
27
|
-
`asserts value is NonNullable<T>`
|
|
28
|
-
|
|
29
|
-
## Defined in
|
|
30
|
-
|
|
31
|
-
[assert-defined.ts:3](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/assert-defined.ts#L3)
|
package/functions/assertInt.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / assertInt
|
|
6
|
-
|
|
7
|
-
# Function: assertInt()
|
|
8
|
-
|
|
9
|
-
> **assertInt**(`value`, `messageOrError`): `asserts value is number`
|
|
10
|
-
|
|
11
|
-
## Parameters
|
|
12
|
-
|
|
13
|
-
### value
|
|
14
|
-
|
|
15
|
-
`unknown`
|
|
16
|
-
|
|
17
|
-
### messageOrError
|
|
18
|
-
|
|
19
|
-
[`MessageOrError`](../type-aliases/MessageOrError.md)
|
|
20
|
-
|
|
21
|
-
## Returns
|
|
22
|
-
|
|
23
|
-
`asserts value is number`
|
|
24
|
-
|
|
25
|
-
## Defined in
|
|
26
|
-
|
|
27
|
-
[is-int.ts:5](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/is-int.ts#L5)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / errorFromMessageOrError
|
|
6
|
-
|
|
7
|
-
# Function: errorFromMessageOrError()
|
|
8
|
-
|
|
9
|
-
> **errorFromMessageOrError**(`messageOrError`, `defaultConstructor`): `Error`
|
|
10
|
-
|
|
11
|
-
Helper for guards which expect text or an error, or
|
|
12
|
-
can generate one when needed.
|
|
13
|
-
|
|
14
|
-
## Parameters
|
|
15
|
-
|
|
16
|
-
### messageOrError
|
|
17
|
-
|
|
18
|
-
[`MessageOrError`](../type-aliases/MessageOrError.md)
|
|
19
|
-
|
|
20
|
-
### defaultConstructor
|
|
21
|
-
|
|
22
|
-
(`message`) => `Error`
|
|
23
|
-
|
|
24
|
-
## Returns
|
|
25
|
-
|
|
26
|
-
`Error`
|
|
27
|
-
|
|
28
|
-
## Defined in
|
|
29
|
-
|
|
30
|
-
[error-from-message.ts:10](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/error-from-message.ts#L10)
|
package/functions/expectInt.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / expectInt
|
|
6
|
-
|
|
7
|
-
# Function: expectInt()
|
|
8
|
-
|
|
9
|
-
> **expectInt**(`obj`, `messageOrError`): `number`
|
|
10
|
-
|
|
11
|
-
## Parameters
|
|
12
|
-
|
|
13
|
-
### obj
|
|
14
|
-
|
|
15
|
-
`unknown`
|
|
16
|
-
|
|
17
|
-
### messageOrError
|
|
18
|
-
|
|
19
|
-
[`MessageOrError`](../type-aliases/MessageOrError.md)
|
|
20
|
-
|
|
21
|
-
## Returns
|
|
22
|
-
|
|
23
|
-
`number`
|
|
24
|
-
|
|
25
|
-
## Defined in
|
|
26
|
-
|
|
27
|
-
[is-int.ts:11](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/is-int.ts#L11)
|
package/functions/hasArray.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / hasArray
|
|
6
|
-
|
|
7
|
-
# Function: hasArray()
|
|
8
|
-
|
|
9
|
-
Guard for whether the given value is an object which has a property with its own array value.
|
|
10
|
-
|
|
11
|
-
## Call Signature
|
|
12
|
-
|
|
13
|
-
> **hasArray**\<`Name`\>(`obj`, `name`, `predicate`?): `obj is { [K in string]: unknown[] }`
|
|
14
|
-
|
|
15
|
-
Guard for whether the given value is an object which has a property with its own array value.
|
|
16
|
-
This variant does not exhaustively check the items of the array.
|
|
17
|
-
|
|
18
|
-
### Type Parameters
|
|
19
|
-
|
|
20
|
-
• **Name** *extends* `string`
|
|
21
|
-
|
|
22
|
-
### Parameters
|
|
23
|
-
|
|
24
|
-
#### obj
|
|
25
|
-
|
|
26
|
-
`unknown`
|
|
27
|
-
|
|
28
|
-
#### name
|
|
29
|
-
|
|
30
|
-
`Name`
|
|
31
|
-
|
|
32
|
-
#### predicate?
|
|
33
|
-
|
|
34
|
-
`undefined`
|
|
35
|
-
|
|
36
|
-
### Returns
|
|
37
|
-
|
|
38
|
-
`obj is { [K in string]: unknown[] }`
|
|
39
|
-
|
|
40
|
-
### Defined in
|
|
41
|
-
|
|
42
|
-
[has-array.ts:8](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/has-array.ts#L8)
|
|
43
|
-
|
|
44
|
-
## Call Signature
|
|
45
|
-
|
|
46
|
-
> **hasArray**\<`Name`, `Item`\>(`obj`, `name`, `predicate`?): `obj is { [K in string]: Item[] }`
|
|
47
|
-
|
|
48
|
-
Guard for whether the given value is an object which has a property with its own array value.
|
|
49
|
-
This variant exhaustively checks the items of the array against the given predicate.
|
|
50
|
-
|
|
51
|
-
### Type Parameters
|
|
52
|
-
|
|
53
|
-
• **Name** *extends* `string`
|
|
54
|
-
|
|
55
|
-
• **Item**
|
|
56
|
-
|
|
57
|
-
### Parameters
|
|
58
|
-
|
|
59
|
-
#### obj
|
|
60
|
-
|
|
61
|
-
`unknown`
|
|
62
|
-
|
|
63
|
-
#### name
|
|
64
|
-
|
|
65
|
-
`Name`
|
|
66
|
-
|
|
67
|
-
#### predicate?
|
|
68
|
-
|
|
69
|
-
(`item`, `index`, `items`) => `item is Item`
|
|
70
|
-
|
|
71
|
-
### Returns
|
|
72
|
-
|
|
73
|
-
`obj is { [K in string]: Item[] }`
|
|
74
|
-
|
|
75
|
-
### Defined in
|
|
76
|
-
|
|
77
|
-
[has-array.ts:13](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/has-array.ts#L13)
|
package/functions/hasNumber.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / hasNumber
|
|
6
|
-
|
|
7
|
-
# Function: hasNumber()
|
|
8
|
-
|
|
9
|
-
> **hasNumber**\<`Name`\>(`obj`, `name`): `obj is { [k in string]: string }`
|
|
10
|
-
|
|
11
|
-
## Type Parameters
|
|
12
|
-
|
|
13
|
-
• **Name** *extends* `string`
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
### obj
|
|
18
|
-
|
|
19
|
-
`unknown`
|
|
20
|
-
|
|
21
|
-
### name
|
|
22
|
-
|
|
23
|
-
`Name`
|
|
24
|
-
|
|
25
|
-
## Returns
|
|
26
|
-
|
|
27
|
-
`obj is { [k in string]: string }`
|
|
28
|
-
|
|
29
|
-
## Defined in
|
|
30
|
-
|
|
31
|
-
[has-number.ts:3](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/has-number.ts#L3)
|
package/functions/hasOwn.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / hasOwn
|
|
6
|
-
|
|
7
|
-
# Function: hasOwn()
|
|
8
|
-
|
|
9
|
-
## Call Signature
|
|
10
|
-
|
|
11
|
-
> **hasOwn**\<`Name`\>(`obj`, `name`): `obj is { [K in string]: unknown }`
|
|
12
|
-
|
|
13
|
-
### Type Parameters
|
|
14
|
-
|
|
15
|
-
• **Name** *extends* `string`
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
#### obj
|
|
20
|
-
|
|
21
|
-
`unknown`
|
|
22
|
-
|
|
23
|
-
#### name
|
|
24
|
-
|
|
25
|
-
`Name`
|
|
26
|
-
|
|
27
|
-
### Returns
|
|
28
|
-
|
|
29
|
-
`obj is { [K in string]: unknown }`
|
|
30
|
-
|
|
31
|
-
### Defined in
|
|
32
|
-
|
|
33
|
-
[has-own.ts:3](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/has-own.ts#L3)
|
|
34
|
-
|
|
35
|
-
## Call Signature
|
|
36
|
-
|
|
37
|
-
> **hasOwn**\<`Name`, `T`\>(`obj`, `name`, `predicate`): `obj is { [K in string]: T }`
|
|
38
|
-
|
|
39
|
-
### Type Parameters
|
|
40
|
-
|
|
41
|
-
• **Name** *extends* `string`
|
|
42
|
-
|
|
43
|
-
• **T**
|
|
44
|
-
|
|
45
|
-
### Parameters
|
|
46
|
-
|
|
47
|
-
#### obj
|
|
48
|
-
|
|
49
|
-
`unknown`
|
|
50
|
-
|
|
51
|
-
#### name
|
|
52
|
-
|
|
53
|
-
`Name`
|
|
54
|
-
|
|
55
|
-
#### predicate
|
|
56
|
-
|
|
57
|
-
(`value`) => `value is T`
|
|
58
|
-
|
|
59
|
-
### Returns
|
|
60
|
-
|
|
61
|
-
`obj is { [K in string]: T }`
|
|
62
|
-
|
|
63
|
-
### Defined in
|
|
64
|
-
|
|
65
|
-
[has-own.ts:4](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/has-own.ts#L4)
|
package/functions/isInt.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / isInt
|
|
6
|
-
|
|
7
|
-
# Function: isInt()
|
|
8
|
-
|
|
9
|
-
> **isInt**(`obj`): `obj is number`
|
|
10
|
-
|
|
11
|
-
## Parameters
|
|
12
|
-
|
|
13
|
-
### obj
|
|
14
|
-
|
|
15
|
-
`unknown`
|
|
16
|
-
|
|
17
|
-
## Returns
|
|
18
|
-
|
|
19
|
-
`obj is number`
|
|
20
|
-
|
|
21
|
-
## Defined in
|
|
22
|
-
|
|
23
|
-
[is-int.ts:3](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/is-int.ts#L3)
|
package/functions/isListOf.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / isListOf
|
|
6
|
-
|
|
7
|
-
# Function: isListOf()
|
|
8
|
-
|
|
9
|
-
> **isListOf**\<`T`\>(`list`, `predicate`): `list is T[]`
|
|
10
|
-
|
|
11
|
-
## Type Parameters
|
|
12
|
-
|
|
13
|
-
• **T**
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
### list
|
|
18
|
-
|
|
19
|
-
`unknown`
|
|
20
|
-
|
|
21
|
-
### predicate
|
|
22
|
-
|
|
23
|
-
(`item`, `index`, `items`) => `item is T`
|
|
24
|
-
|
|
25
|
-
## Returns
|
|
26
|
-
|
|
27
|
-
`list is T[]`
|
|
28
|
-
|
|
29
|
-
## Defined in
|
|
30
|
-
|
|
31
|
-
[is-list-of.ts:1](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/is-list-of.ts#L1)
|
package/functions/isObject.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / isObject
|
|
6
|
-
|
|
7
|
-
# Function: isObject()
|
|
8
|
-
|
|
9
|
-
> **isObject**(`obj`): `obj is object`
|
|
10
|
-
|
|
11
|
-
## Parameters
|
|
12
|
-
|
|
13
|
-
### obj
|
|
14
|
-
|
|
15
|
-
`unknown`
|
|
16
|
-
|
|
17
|
-
## Returns
|
|
18
|
-
|
|
19
|
-
`obj is object`
|
|
20
|
-
|
|
21
|
-
## Defined in
|
|
22
|
-
|
|
23
|
-
[is-object.ts:1](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/is-object.ts#L1)
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / isPlainObject
|
|
6
|
-
|
|
7
|
-
# Function: isPlainObject()
|
|
8
|
-
|
|
9
|
-
> **isPlainObject**(`obj`): `obj is Record<never, never>`
|
|
10
|
-
|
|
11
|
-
## Parameters
|
|
12
|
-
|
|
13
|
-
### obj
|
|
14
|
-
|
|
15
|
-
`unknown`
|
|
16
|
-
|
|
17
|
-
## Returns
|
|
18
|
-
|
|
19
|
-
`obj is Record<never, never>`
|
|
20
|
-
|
|
21
|
-
## Defined in
|
|
22
|
-
|
|
23
|
-
[is-object.ts:5](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/is-object.ts#L5)
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / isUnaryPredicate
|
|
6
|
-
|
|
7
|
-
# Function: isUnaryPredicate()
|
|
8
|
-
|
|
9
|
-
> **isUnaryPredicate**(`obj`): `obj is UnaryPredicate<unknown>`
|
|
10
|
-
|
|
11
|
-
Tests whether the given object is a function and takes at
|
|
12
|
-
least one parameter, and could maybe act as a unary predicate.
|
|
13
|
-
Warning! Since no type information is available at runtime,
|
|
14
|
-
it may not actually act as a predicate!
|
|
15
|
-
|
|
16
|
-
## Parameters
|
|
17
|
-
|
|
18
|
-
### obj
|
|
19
|
-
|
|
20
|
-
`unknown`
|
|
21
|
-
|
|
22
|
-
## Returns
|
|
23
|
-
|
|
24
|
-
`obj is UnaryPredicate<unknown>`
|
|
25
|
-
|
|
26
|
-
## Defined in
|
|
27
|
-
|
|
28
|
-
[is-predicate.ts:9](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/is-predicate.ts#L9)
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
[**@rickosborne/guard v2024.12.28**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rickosborne/guard](../README.md) / MessageOrError
|
|
6
|
-
|
|
7
|
-
# Type Alias: MessageOrError
|
|
8
|
-
|
|
9
|
-
> **MessageOrError**: `string` \| `Error` \| () => `string` \| `Error`
|
|
10
|
-
|
|
11
|
-
A message, an error, or something which can generate one of those.
|
|
12
|
-
|
|
13
|
-
## Defined in
|
|
14
|
-
|
|
15
|
-
[error-from-message.ts:4](https://github.com/rickosborne/es-js-ts/blob/b9df3c6eb00a5aca153cd4895e7af44eeb074ddb/guard/ts/error-from-message.ts#L4)
|