@augment-vir/core 30.0.3 → 30.0.5
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.
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Jsonify, Primitive } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* These are similar in purpose, name, and structure to type-fest's JsonValue types but these are
|
|
4
|
+
* more permissive. The goal here is to allow any types that do not get serialized into just empty
|
|
5
|
+
* objects. (For example, JSON.stringify(new Map()) returns "{}", so we don't want to allow that
|
|
6
|
+
* type.)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* All primitives that are allowed in JSON.
|
|
10
|
+
*
|
|
11
|
+
* Note that while `undefined` is allowed here, it will be behave slightly differently than the
|
|
12
|
+
* others.
|
|
13
|
+
*
|
|
14
|
+
* - `JSON.stringify(undefined)` will output `undefined`, not a string.
|
|
15
|
+
* - `JSON.stringify({a: null, b: undefined})` will output `'{"a": null}'`, omitting the `b` key
|
|
16
|
+
* entirely.
|
|
17
|
+
*
|
|
18
|
+
* @category JSON : Common
|
|
19
|
+
* @category Package : @augment-vir/common
|
|
20
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
21
|
+
*/
|
|
22
|
+
export type JsonCompatiblePrimitive = Jsonify<Primitive> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* An object that only contains JSON compatible values.
|
|
25
|
+
*
|
|
26
|
+
* @category JSON : Common
|
|
27
|
+
* @category Package : @augment-vir/common
|
|
28
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
29
|
+
*/
|
|
30
|
+
export type JsonCompatibleObject = Partial<{
|
|
31
|
+
readonly [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
|
|
32
|
+
}> | Partial<{
|
|
33
|
+
[key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* An array that only contains JSON compatible values.
|
|
37
|
+
*
|
|
38
|
+
* @category JSON : Common
|
|
39
|
+
* @category Package : @augment-vir/common
|
|
40
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
41
|
+
*/
|
|
42
|
+
export type JsonCompatibleArray = JsonCompatibleValue[] | ReadonlyArray<JsonCompatibleValue>;
|
|
43
|
+
/**
|
|
44
|
+
* Any JSON compatible value.
|
|
45
|
+
*
|
|
46
|
+
* @category JSON : Common
|
|
47
|
+
* @category Package : @augment-vir/common
|
|
48
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
49
|
+
*/
|
|
50
|
+
export type JsonCompatibleValue = JsonCompatiblePrimitive | JsonCompatibleObject | JsonCompatibleArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './augments/error/error-message.js';
|
|
|
7
7
|
export * from './augments/function/generic-function-type.js';
|
|
8
8
|
export * from './augments/function/typed-function-type.js';
|
|
9
9
|
export * from './augments/http/http-status.js';
|
|
10
|
+
export * from './augments/json/json-compatible.js';
|
|
10
11
|
export * from './augments/narrow-type.js';
|
|
11
12
|
export * from './augments/object/generic-object-type.js';
|
|
12
13
|
export * from './augments/object/object-keys.js';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './augments/error/error-message.js';
|
|
|
7
7
|
export * from './augments/function/generic-function-type.js';
|
|
8
8
|
export * from './augments/function/typed-function-type.js';
|
|
9
9
|
export * from './augments/http/http-status.js';
|
|
10
|
+
export * from './augments/json/json-compatible.js';
|
|
10
11
|
export * from './augments/narrow-type.js';
|
|
11
12
|
export * from './augments/object/generic-object-type.js';
|
|
12
13
|
export * from './augments/object/object-keys.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/core",
|
|
3
|
-
"version": "30.0.
|
|
3
|
+
"version": "30.0.5",
|
|
4
4
|
"description": "Core augment-vir augments. Use @augment-vir/common instead.",
|
|
5
5
|
"homepage": "https://github.com/electrovir/augment-vir",
|
|
6
6
|
"bugs": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"type-fest": "^4.26.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^22.5.
|
|
36
|
+
"@types/node": "^22.5.5",
|
|
37
37
|
"c8": "^10.1.2",
|
|
38
38
|
"istanbul-smart-text-reporter": "^1.1.4"
|
|
39
39
|
},
|