@rickosborne/guard 2024.12.25 → 2024.12.28

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.
Files changed (105) hide show
  1. package/README.md +24 -1
  2. package/{dist/cjs → cjs}/index.js +9 -1
  3. package/cjs/index.js.map +1 -0
  4. package/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  5. package/esm/index.js +10 -0
  6. package/esm/index.js.map +1 -0
  7. package/esm/tsconfig.module.tsbuildinfo +1 -0
  8. package/functions/assertDefined.md +31 -0
  9. package/functions/assertInt.md +27 -0
  10. package/functions/errorFromMessageOrError.md +30 -0
  11. package/functions/expectInt.md +27 -0
  12. package/functions/hasArray.md +77 -0
  13. package/functions/hasNumber.md +31 -0
  14. package/functions/hasOwn.md +65 -0
  15. package/functions/isInt.md +23 -0
  16. package/functions/isListOf.md +31 -0
  17. package/functions/isObject.md +23 -0
  18. package/functions/isPlainObject.md +23 -0
  19. package/functions/isUnaryPredicate.md +28 -0
  20. package/package.json +7 -29
  21. package/type-aliases/MessageOrError.md +15 -0
  22. package/types/index.d.ts +9 -0
  23. package/{dist/types → types}/index.js +9 -1
  24. package/types/index.js.map +1 -0
  25. package/types/tsconfig.types.tsbuildinfo +1 -0
  26. package/dist/cjs/index.js.map +0 -1
  27. package/dist/cjs/ts/index.js +0 -26
  28. package/dist/cjs/ts/index.js.map +0 -1
  29. package/dist/cjs/tsconfig.cjs.tsbuildinfo +0 -1
  30. package/dist/esm/index.js +0 -2
  31. package/dist/esm/index.js.map +0 -1
  32. package/dist/esm/ts/index.js +0 -10
  33. package/dist/esm/ts/index.js.map +0 -1
  34. package/dist/esm/tsconfig.module.tsbuildinfo +0 -1
  35. package/dist/types/index.d.ts +0 -1
  36. package/dist/types/index.js.map +0 -1
  37. package/dist/types/ts/index.d.ts +0 -9
  38. package/dist/types/ts/index.js +0 -26
  39. package/dist/types/ts/index.js.map +0 -1
  40. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  41. /package/{dist/cjs → cjs}/package.json +0 -0
  42. /package/{dist/cjs → cjs}/ts/assert-defined.js +0 -0
  43. /package/{dist/cjs → cjs}/ts/assert-defined.js.map +0 -0
  44. /package/{dist/cjs → cjs}/ts/error-from-message.js +0 -0
  45. /package/{dist/cjs → cjs}/ts/error-from-message.js.map +0 -0
  46. /package/{dist/cjs → cjs}/ts/has-array.js +0 -0
  47. /package/{dist/cjs → cjs}/ts/has-array.js.map +0 -0
  48. /package/{dist/cjs → cjs}/ts/has-number.js +0 -0
  49. /package/{dist/cjs → cjs}/ts/has-number.js.map +0 -0
  50. /package/{dist/cjs → cjs}/ts/has-own.js +0 -0
  51. /package/{dist/cjs → cjs}/ts/has-own.js.map +0 -0
  52. /package/{dist/cjs → cjs}/ts/is-int.js +0 -0
  53. /package/{dist/cjs → cjs}/ts/is-int.js.map +0 -0
  54. /package/{dist/cjs → cjs}/ts/is-list-of.js +0 -0
  55. /package/{dist/cjs → cjs}/ts/is-list-of.js.map +0 -0
  56. /package/{dist/cjs → cjs}/ts/is-object.js +0 -0
  57. /package/{dist/cjs → cjs}/ts/is-object.js.map +0 -0
  58. /package/{dist/cjs → cjs}/ts/is-predicate.js +0 -0
  59. /package/{dist/cjs → cjs}/ts/is-predicate.js.map +0 -0
  60. /package/{dist/esm → esm}/package.json +0 -0
  61. /package/{dist/esm → esm}/ts/assert-defined.js +0 -0
  62. /package/{dist/esm → esm}/ts/assert-defined.js.map +0 -0
  63. /package/{dist/esm → esm}/ts/error-from-message.js +0 -0
  64. /package/{dist/esm → esm}/ts/error-from-message.js.map +0 -0
  65. /package/{dist/esm → esm}/ts/has-array.js +0 -0
  66. /package/{dist/esm → esm}/ts/has-array.js.map +0 -0
  67. /package/{dist/esm → esm}/ts/has-number.js +0 -0
  68. /package/{dist/esm → esm}/ts/has-number.js.map +0 -0
  69. /package/{dist/esm → esm}/ts/has-own.js +0 -0
  70. /package/{dist/esm → esm}/ts/has-own.js.map +0 -0
  71. /package/{dist/esm → esm}/ts/is-int.js +0 -0
  72. /package/{dist/esm → esm}/ts/is-int.js.map +0 -0
  73. /package/{dist/esm → esm}/ts/is-list-of.js +0 -0
  74. /package/{dist/esm → esm}/ts/is-list-of.js.map +0 -0
  75. /package/{dist/esm → esm}/ts/is-object.js +0 -0
  76. /package/{dist/esm → esm}/ts/is-object.js.map +0 -0
  77. /package/{dist/esm → esm}/ts/is-predicate.js +0 -0
  78. /package/{dist/esm → esm}/ts/is-predicate.js.map +0 -0
  79. /package/{dist/types → types}/ts/assert-defined.d.ts +0 -0
  80. /package/{dist/types → types}/ts/assert-defined.js +0 -0
  81. /package/{dist/types → types}/ts/assert-defined.js.map +0 -0
  82. /package/{dist/types → types}/ts/error-from-message.d.ts +0 -0
  83. /package/{dist/types → types}/ts/error-from-message.js +0 -0
  84. /package/{dist/types → types}/ts/error-from-message.js.map +0 -0
  85. /package/{dist/types → types}/ts/has-array.d.ts +0 -0
  86. /package/{dist/types → types}/ts/has-array.js +0 -0
  87. /package/{dist/types → types}/ts/has-array.js.map +0 -0
  88. /package/{dist/types → types}/ts/has-number.d.ts +0 -0
  89. /package/{dist/types → types}/ts/has-number.js +0 -0
  90. /package/{dist/types → types}/ts/has-number.js.map +0 -0
  91. /package/{dist/types → types}/ts/has-own.d.ts +0 -0
  92. /package/{dist/types → types}/ts/has-own.js +0 -0
  93. /package/{dist/types → types}/ts/has-own.js.map +0 -0
  94. /package/{dist/types → types}/ts/is-int.d.ts +0 -0
  95. /package/{dist/types → types}/ts/is-int.js +0 -0
  96. /package/{dist/types → types}/ts/is-int.js.map +0 -0
  97. /package/{dist/types → types}/ts/is-list-of.d.ts +0 -0
  98. /package/{dist/types → types}/ts/is-list-of.js +0 -0
  99. /package/{dist/types → types}/ts/is-list-of.js.map +0 -0
  100. /package/{dist/types → types}/ts/is-object.d.ts +0 -0
  101. /package/{dist/types → types}/ts/is-object.js +0 -0
  102. /package/{dist/types → types}/ts/is-object.js.map +0 -0
  103. /package/{dist/types → types}/ts/is-predicate.d.ts +0 -0
  104. /package/{dist/types → types}/ts/is-predicate.js +0 -0
  105. /package/{dist/types → types}/ts/is-predicate.js.map +0 -0
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
+ **@rickosborne/guard v2024.12.28**
2
+
3
+ ***
4
+
1
5
  # @rickosborne/guard
2
6
 
3
- Basic type guards building on `@rickosborne/typical`.
7
+ Basic type guards building on [@rickosborne/typical](https://www.npmjs.com/package/@rickosborne/typical).
8
+
9
+ ## Type Aliases
10
+
11
+ - [MessageOrError](type-aliases/MessageOrError.md)
12
+
13
+ ## Functions
14
+
15
+ - [assertDefined](functions/assertDefined.md)
16
+ - [assertInt](functions/assertInt.md)
17
+ - [errorFromMessageOrError](functions/errorFromMessageOrError.md)
18
+ - [expectInt](functions/expectInt.md)
19
+ - [hasArray](functions/hasArray.md)
20
+ - [hasNumber](functions/hasNumber.md)
21
+ - [hasOwn](functions/hasOwn.md)
22
+ - [isInt](functions/isInt.md)
23
+ - [isListOf](functions/isListOf.md)
24
+ - [isObject](functions/isObject.md)
25
+ - [isPlainObject](functions/isPlainObject.md)
26
+ - [isUnaryPredicate](functions/isUnaryPredicate.md)
@@ -14,5 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ts/index.js"), exports);
17
+ __exportStar(require("./ts/assert-defined.js"), exports);
18
+ __exportStar(require("./ts/error-from-message.js"), exports);
19
+ __exportStar(require("./ts/has-array.js"), exports);
20
+ __exportStar(require("./ts/has-number.js"), exports);
21
+ __exportStar(require("./ts/has-own.js"), exports);
22
+ __exportStar(require("./ts/is-int.js"), exports);
23
+ __exportStar(require("./ts/is-list-of.js"), exports);
24
+ __exportStar(require("./ts/is-object.js"), exports);
25
+ __exportStar(require("./ts/is-predicate.js"), exports);
18
26
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,6DAA2C;AAC3C,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC;AACnC,oDAAkC;AAClC,uDAAqC"}
@@ -0,0 +1 @@
1
+ {"root":["../../index.ts","../../ts/assert-defined.ts","../../ts/error-from-message.ts","../../ts/has-array.ts","../../ts/has-number.ts","../../ts/has-own.ts","../../ts/is-int.ts","../../ts/is-list-of.ts","../../ts/is-object.ts","../../ts/is-predicate.ts"],"version":"5.7.2"}
package/esm/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export * from "./ts/assert-defined.js";
2
+ export * from "./ts/error-from-message.js";
3
+ export * from "./ts/has-array.js";
4
+ export * from "./ts/has-number.js";
5
+ export * from "./ts/has-own.js";
6
+ export * from "./ts/is-int.js";
7
+ export * from "./ts/is-list-of.js";
8
+ export * from "./ts/is-object.js";
9
+ export * from "./ts/is-predicate.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ {"root":["../../index.ts","../../ts/assert-defined.ts","../../ts/error-from-message.ts","../../ts/has-array.ts","../../ts/has-number.ts","../../ts/has-own.ts","../../ts/is-int.ts","../../ts/is-list-of.ts","../../ts/is-object.ts","../../ts/is-predicate.ts"],"version":"5.7.2"}
@@ -0,0 +1,31 @@
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)
@@ -0,0 +1,27 @@
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)
@@ -0,0 +1,30 @@
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)
@@ -0,0 +1,27 @@
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)
@@ -0,0 +1,77 @@
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)
@@ -0,0 +1,31 @@
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)
@@ -0,0 +1,65 @@
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)
@@ -0,0 +1,23 @@
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)
@@ -0,0 +1,31 @@
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)
@@ -0,0 +1,23 @@
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)
@@ -0,0 +1,23 @@
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)
@@ -0,0 +1,28 @@
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)
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://rickosborne.org"
5
5
  },
6
6
  "dependencies": {
7
- "@rickosborne/typical": "2024.12.26"
7
+ "@rickosborne/typical": "2024.12.28"
8
8
  },
9
9
  "description": "Rick Osborne's collection of type guards.",
10
10
  "engines": {
@@ -12,18 +12,15 @@
12
12
  },
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/types/index.d.ts",
16
- "import": "./dist/esm/index.js",
17
- "require": "./dist/cjs/index.js",
18
- "default": "./dist/esm/index.js"
15
+ "types": "./types/index.d.ts",
16
+ "import": "./esm/index.js",
17
+ "require": "./cjs/index.js",
18
+ "default": "./esm/index.js"
19
19
  }
20
20
  },
21
- "files": [
22
- "dist"
23
- ],
24
21
  "homepage": "https://github.com/rickosborne/es-js-ts",
25
22
  "license": "CC-BY-NC-SA-4.0",
26
- "main": "dist/cjs/index.js",
23
+ "main": "cjs/index.js",
27
24
  "name": "@rickosborne/guard",
28
25
  "private": false,
29
26
  "publishConfig": {
@@ -33,24 +30,5 @@
33
30
  "type": "git",
34
31
  "url": "git+https://github.com/rickosborne/es-js-ts.git"
35
32
  },
36
- "scripts": {
37
- "build": "tsc -b tsconfig.cjs.json tsconfig.module.json tsconfig.types.json && cp ../static/esm-package.json dist/esm/package.json && cp ../static/cjs-package.json dist/cjs/package.json",
38
- "check-exports": "tsx ../scripts/check-exports.ts guard",
39
- "clean": "rm -rf ./dist",
40
- "lint": "eslint .",
41
- "lint:fix": "eslint --fix .",
42
- "prebuild": "npm run clean && npm run type-check",
43
- "prepub": "npm run prepublish",
44
- "prepub:dry-run": "npm run prepublish",
45
- "prepublish": "npm run build && npm run lint && npm run check-exports",
46
- "pub": "npm publish",
47
- "pub:dry-run": "npm publish --dry-run",
48
- "reinstall": "rm -rf ./node_modules && npm ci",
49
- "reinstall:full": "rm -rf ./node_modules package-lock.json && npm install",
50
- "test": "mocha",
51
- "test:coverage": "nyc mocha",
52
- "type-check": "tsc --noEmit",
53
- "upgrade:check": "npm-check-updates"
54
- },
55
- "version": "2024.12.25"
33
+ "version": "2024.12.28"
56
34
  }
@@ -0,0 +1,15 @@
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)
@@ -0,0 +1,9 @@
1
+ export * from "./ts/assert-defined.js";
2
+ export * from "./ts/error-from-message.js";
3
+ export * from "./ts/has-array.js";
4
+ export * from "./ts/has-number.js";
5
+ export * from "./ts/has-own.js";
6
+ export * from "./ts/is-int.js";
7
+ export * from "./ts/is-list-of.js";
8
+ export * from "./ts/is-object.js";
9
+ export * from "./ts/is-predicate.js";
@@ -14,5 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ts/index.js"), exports);
17
+ __exportStar(require("./ts/assert-defined.js"), exports);
18
+ __exportStar(require("./ts/error-from-message.js"), exports);
19
+ __exportStar(require("./ts/has-array.js"), exports);
20
+ __exportStar(require("./ts/has-number.js"), exports);
21
+ __exportStar(require("./ts/has-own.js"), exports);
22
+ __exportStar(require("./ts/is-int.js"), exports);
23
+ __exportStar(require("./ts/is-list-of.js"), exports);
24
+ __exportStar(require("./ts/is-object.js"), exports);
25
+ __exportStar(require("./ts/is-predicate.js"), exports);
18
26
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,6DAA2C;AAC3C,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,iDAA+B;AAC/B,qDAAmC;AACnC,oDAAkC;AAClC,uDAAqC"}
@@ -0,0 +1 @@
1
+ {"root":["../../index.ts","../../ts/assert-defined.ts","../../ts/error-from-message.ts","../../ts/has-array.ts","../../ts/has-number.ts","../../ts/has-own.ts","../../ts/is-int.ts","../../ts/is-list-of.ts","../../ts/is-object.ts","../../ts/is-predicate.ts"],"version":"5.7.2"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./assert-defined.js"), exports);
18
- __exportStar(require("./error-from-message.js"), exports);
19
- __exportStar(require("./has-array.js"), exports);
20
- __exportStar(require("./has-number.js"), exports);
21
- __exportStar(require("./has-own.js"), exports);
22
- __exportStar(require("./is-int.js"), exports);
23
- __exportStar(require("./is-list-of.js"), exports);
24
- __exportStar(require("./is-object.js"), exports);
25
- __exportStar(require("./is-predicate.js"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,0DAAwC;AACxC,iDAA+B;AAC/B,kDAAgC;AAChC,+CAA6B;AAC7B,8CAA4B;AAC5B,kDAAgC;AAChC,iDAA+B;AAC/B,oDAAkC"}
@@ -1 +0,0 @@
1
- {"root":["../../index.ts","../../ts/assert-defined.ts","../../ts/error-from-message.ts","../../ts/has-array.ts","../../ts/has-number.ts","../../ts/has-own.ts","../../ts/index.ts","../../ts/is-int.ts","../../ts/is-list-of.ts","../../ts/is-object.ts","../../ts/is-predicate.ts"],"version":"5.7.2"}
package/dist/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from "./ts/index.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -1,10 +0,0 @@
1
- export * from "./assert-defined.js";
2
- export * from "./error-from-message.js";
3
- export * from "./has-array.js";
4
- export * from "./has-number.js";
5
- export * from "./has-own.js";
6
- export * from "./is-int.js";
7
- export * from "./is-list-of.js";
8
- export * from "./is-object.js";
9
- export * from "./is-predicate.js";
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"root":["../../index.ts","../../ts/assert-defined.ts","../../ts/error-from-message.ts","../../ts/has-array.ts","../../ts/has-number.ts","../../ts/has-own.ts","../../ts/index.ts","../../ts/is-int.ts","../../ts/is-list-of.ts","../../ts/is-object.ts","../../ts/is-predicate.ts"],"version":"5.7.2"}
@@ -1 +0,0 @@
1
- export * from "./ts/index.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -1,9 +0,0 @@
1
- export * from "./assert-defined.js";
2
- export * from "./error-from-message.js";
3
- export * from "./has-array.js";
4
- export * from "./has-number.js";
5
- export * from "./has-own.js";
6
- export * from "./is-int.js";
7
- export * from "./is-list-of.js";
8
- export * from "./is-object.js";
9
- export * from "./is-predicate.js";
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./assert-defined.js"), exports);
18
- __exportStar(require("./error-from-message.js"), exports);
19
- __exportStar(require("./has-array.js"), exports);
20
- __exportStar(require("./has-number.js"), exports);
21
- __exportStar(require("./has-own.js"), exports);
22
- __exportStar(require("./is-int.js"), exports);
23
- __exportStar(require("./is-list-of.js"), exports);
24
- __exportStar(require("./is-object.js"), exports);
25
- __exportStar(require("./is-predicate.js"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,0DAAwC;AACxC,iDAA+B;AAC/B,kDAAgC;AAChC,+CAA6B;AAC7B,8CAA4B;AAC5B,kDAAgC;AAChC,iDAA+B;AAC/B,oDAAkC"}
@@ -1 +0,0 @@
1
- {"root":["../../index.ts","../../ts/assert-defined.ts","../../ts/error-from-message.ts","../../ts/has-array.ts","../../ts/has-number.ts","../../ts/has-own.ts","../../ts/index.ts","../../ts/is-int.ts","../../ts/is-list-of.ts","../../ts/is-object.ts","../../ts/is-predicate.ts"],"version":"5.7.2"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes