@augment-vir/core 31.71.4 → 31.72.0
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/dist/augments/primitive.d.ts +10 -0
- package/dist/augments/primitive.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given value is a primitive or not. Does not type guard. For type guarding, use the
|
|
3
|
+
* `check.isPrimitive` guard from `@augment-vir/assert`.
|
|
4
|
+
*
|
|
5
|
+
* @category Type
|
|
6
|
+
* @category Object
|
|
7
|
+
* @category Package : @augment-vir/common
|
|
8
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
9
|
+
*/
|
|
10
|
+
export declare function isPrimitive(this: void, value: unknown): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given value is a primitive or not. Does not type guard. For type guarding, use the
|
|
3
|
+
* `check.isPrimitive` guard from `@augment-vir/assert`.
|
|
4
|
+
*
|
|
5
|
+
* @category Type
|
|
6
|
+
* @category Object
|
|
7
|
+
* @category Package : @augment-vir/common
|
|
8
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
9
|
+
*/
|
|
10
|
+
export function isPrimitive(value) {
|
|
11
|
+
/**
|
|
12
|
+
* `null` is a primitive but `typeof null` gives `'object'` so we have to special case `null`
|
|
13
|
+
* here.
|
|
14
|
+
*/
|
|
15
|
+
return value === null || (typeof value !== 'object' && typeof value !== 'function');
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from './augments/object/required-keys.js';
|
|
|
22
22
|
export * from './augments/object/stringify.js';
|
|
23
23
|
export * from './augments/overwrite-type.js';
|
|
24
24
|
export * from './augments/partial-type.js';
|
|
25
|
+
export * from './augments/primitive.js';
|
|
25
26
|
export * from './augments/promise/deferred-promise.js';
|
|
26
27
|
export * from './augments/promise/maybe-promise.js';
|
|
27
28
|
export * from './augments/promise/wait.js';
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export * from './augments/object/required-keys.js';
|
|
|
22
22
|
export * from './augments/object/stringify.js';
|
|
23
23
|
export * from './augments/overwrite-type.js';
|
|
24
24
|
export * from './augments/partial-type.js';
|
|
25
|
+
export * from './augments/primitive.js';
|
|
25
26
|
export * from './augments/promise/deferred-promise.js';
|
|
26
27
|
export * from './augments/promise/maybe-promise.js';
|
|
27
28
|
export * from './augments/promise/wait.js';
|