@bemedev/typings 0.2.2 → 0.4.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/lib/constants.cjs +4 -2
- package/lib/constants.d.ts +7 -5
- package/lib/constants.js +3 -3
- package/lib/helpers/any.cjs +4 -5
- package/lib/helpers/any.d.ts +4 -2
- package/lib/helpers/any.js +5 -5
- package/lib/helpers/array.cjs +6 -6
- package/lib/helpers/array.d.ts +4 -2
- package/lib/helpers/array.js +6 -6
- package/lib/helpers/custom.cjs +21 -4
- package/lib/helpers/custom.d.ts +20 -3
- package/lib/helpers/custom.js +22 -4
- package/lib/helpers/index.cjs +4 -30
- package/lib/helpers/index.d.ts +1 -0
- package/lib/helpers/index.js +4 -25
- package/lib/helpers/intersection.cjs +2 -8
- package/lib/helpers/intersection.d.ts +1 -2
- package/lib/helpers/intersection.js +2 -8
- package/lib/helpers/litterals.cjs +7 -3
- package/lib/helpers/litterals.d.ts +4 -2
- package/lib/helpers/litterals.js +7 -3
- package/lib/helpers/object.cjs +10 -0
- package/lib/helpers/object.d.ts +5 -0
- package/lib/helpers/object.js +9 -0
- package/lib/helpers/optional.cjs +4 -4
- package/lib/helpers/optional.d.ts +2 -3
- package/lib/helpers/optional.js +4 -4
- package/lib/helpers/partial.cjs +2 -9
- package/lib/helpers/partial.d.ts +1 -2
- package/lib/helpers/partial.js +2 -9
- package/lib/helpers/primitive.cjs +21 -20
- package/lib/helpers/primitive.d.ts +25 -7
- package/lib/helpers/primitive.js +21 -21
- package/lib/helpers/primitiveObject.cjs +8 -7
- package/lib/helpers/primitiveObject.d.ts +8 -3
- package/lib/helpers/primitiveObject.js +8 -8
- package/lib/helpers/readonly.cjs +0 -2
- package/lib/helpers/readonly.js +0 -2
- package/lib/helpers/record.cjs +7 -6
- package/lib/helpers/record.d.ts +4 -2
- package/lib/helpers/record.js +7 -6
- package/lib/helpers/soa.cjs +2 -4
- package/lib/helpers/soa.d.ts +1 -2
- package/lib/helpers/soa.js +2 -4
- package/lib/helpers/sv.cjs +6 -3
- package/lib/helpers/sv.d.ts +4 -2
- package/lib/helpers/sv.js +6 -3
- package/lib/helpers/tuple.cjs +6 -3
- package/lib/helpers/tuple.d.ts +4 -2
- package/lib/helpers/tuple.js +6 -3
- package/lib/helpers/union.cjs +3 -3
- package/lib/helpers/union.d.ts +2 -2
- package/lib/helpers/union.js +3 -3
- package/lib/index.cjs +2 -9
- package/lib/index.d.ts +0 -1
- package/lib/index.js +2 -4
- package/lib/standard.cjs +21 -0
- package/lib/standard.d.ts +7 -0
- package/lib/standard.js +19 -0
- package/lib/standard.types.d.ts +59 -0
- package/lib/type.cjs +49 -0
- package/lib/type.js +48 -0
- package/lib/type.types.d.ts +3 -2
- package/lib/types.cjs +0 -0
- package/lib/types.d.ts +13 -6
- package/lib/types.js +1 -0
- package/lib/utils/expandFn.cjs +8 -2
- package/lib/utils/expandFn.d.ts +5 -1
- package/lib/utils/expandFn.js +8 -3
- package/lib/utils/index.cjs +8 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +5 -0
- package/package.json +16 -2
- package/lib/_virtual/_rolldown/runtime.cjs +0 -13
- package/lib/_virtual/_rolldown/runtime.js +0 -13
- package/lib/constants.cjs.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/helpers/any.cjs.map +0 -1
- package/lib/helpers/any.js.map +0 -1
- package/lib/helpers/array.cjs.map +0 -1
- package/lib/helpers/array.js.map +0 -1
- package/lib/helpers/custom.cjs.map +0 -1
- package/lib/helpers/custom.js.map +0 -1
- package/lib/helpers/index.cjs.map +0 -1
- package/lib/helpers/index.js.map +0 -1
- package/lib/helpers/intersection.cjs.map +0 -1
- package/lib/helpers/intersection.js.map +0 -1
- package/lib/helpers/litterals.cjs.map +0 -1
- package/lib/helpers/litterals.js.map +0 -1
- package/lib/helpers/optional.cjs.map +0 -1
- package/lib/helpers/optional.js.map +0 -1
- package/lib/helpers/partial.cjs.map +0 -1
- package/lib/helpers/partial.js.map +0 -1
- package/lib/helpers/primitive.cjs.map +0 -1
- package/lib/helpers/primitive.js.map +0 -1
- package/lib/helpers/primitiveObject.cjs.map +0 -1
- package/lib/helpers/primitiveObject.js.map +0 -1
- package/lib/helpers/readonly.cjs.map +0 -1
- package/lib/helpers/readonly.js.map +0 -1
- package/lib/helpers/record.cjs.map +0 -1
- package/lib/helpers/record.js.map +0 -1
- package/lib/helpers/soa.cjs.map +0 -1
- package/lib/helpers/soa.js.map +0 -1
- package/lib/helpers/sv.cjs.map +0 -1
- package/lib/helpers/sv.js.map +0 -1
- package/lib/helpers/tuple.cjs.map +0 -1
- package/lib/helpers/tuple.js.map +0 -1
- package/lib/helpers/union.cjs.map +0 -1
- package/lib/helpers/union.js.map +0 -1
- package/lib/utils/expandFn.cjs.map +0 -1
- package/lib/utils/expandFn.js.map +0 -1
package/lib/constants.cjs
CHANGED
|
@@ -18,17 +18,19 @@ const PRIMITIVE_OBJECTS = [
|
|
|
18
18
|
"unknown"
|
|
19
19
|
];
|
|
20
20
|
const OPTIONAL = "$$app-ts => optional$$";
|
|
21
|
+
const UNION = "$$app-ts => union$$";
|
|
21
22
|
const CUSTOM = "$$app-ts => custom$$";
|
|
22
23
|
const PARTIAL = "$$app-ts => partial$$";
|
|
23
24
|
const ARRAY = "$$app-ts => array$$";
|
|
24
25
|
const SOA = "$$app-ts => soa$$";
|
|
26
|
+
const LITTERALS = "$$app-ts => litterals$$";
|
|
25
27
|
//#endregion
|
|
26
28
|
exports.ARRAY = ARRAY;
|
|
27
29
|
exports.CUSTOM = CUSTOM;
|
|
30
|
+
exports.LITTERALS = LITTERALS;
|
|
28
31
|
exports.OPTIONAL = OPTIONAL;
|
|
29
32
|
exports.PARTIAL = PARTIAL;
|
|
30
33
|
exports.PRIMITIVES = PRIMITIVES;
|
|
31
34
|
exports.PRIMITIVE_OBJECTS = PRIMITIVE_OBJECTS;
|
|
32
35
|
exports.SOA = SOA;
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=constants.cjs.map
|
|
36
|
+
exports.UNION = UNION;
|
package/lib/constants.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export declare const PRIMITIVES: readonly ["string", "number", "boolean", "bigint", "symbol", "undefined", "null", "never", "primitive"];
|
|
2
2
|
export declare const PRIMITIVE_OBJECTS: readonly ["date", "any", "object", "unknown"];
|
|
3
|
-
export declare const OPTIONAL
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
3
|
+
export declare const OPTIONAL = "$$app-ts => optional$$";
|
|
4
|
+
export declare const UNION = "$$app-ts => union$$";
|
|
5
|
+
export declare const CUSTOM = "$$app-ts => custom$$";
|
|
6
|
+
export declare const PARTIAL = "$$app-ts => partial$$";
|
|
7
|
+
export declare const ARRAY = "$$app-ts => array$$";
|
|
8
|
+
export declare const SOA = "$$app-ts => soa$$";
|
|
9
|
+
export declare const LITTERALS = "$$app-ts => litterals$$";
|
package/lib/constants.js
CHANGED
|
@@ -17,11 +17,11 @@ const PRIMITIVE_OBJECTS = [
|
|
|
17
17
|
"unknown"
|
|
18
18
|
];
|
|
19
19
|
const OPTIONAL = "$$app-ts => optional$$";
|
|
20
|
+
const UNION = "$$app-ts => union$$";
|
|
20
21
|
const CUSTOM = "$$app-ts => custom$$";
|
|
21
22
|
const PARTIAL = "$$app-ts => partial$$";
|
|
22
23
|
const ARRAY = "$$app-ts => array$$";
|
|
23
24
|
const SOA = "$$app-ts => soa$$";
|
|
25
|
+
const LITTERALS = "$$app-ts => litterals$$";
|
|
24
26
|
//#endregion
|
|
25
|
-
export { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA };
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=constants.js.map
|
|
27
|
+
export { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, UNION };
|
package/lib/helpers/any.cjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
2
3
|
//#region src/helpers/any.ts
|
|
3
|
-
const any = (value) => {
|
|
4
|
-
return value;
|
|
5
|
-
};
|
|
4
|
+
const any = require("../utils/expandFn.cjs").expandFn2((value) => {
|
|
5
|
+
return require_standard.standardize2(value);
|
|
6
|
+
}, "any");
|
|
6
7
|
//#endregion
|
|
7
8
|
exports.any = any;
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=any.cjs.map
|
package/lib/helpers/any.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { NotReadonly, ObjectT } from "../types";
|
|
2
|
-
declare const any: <const T extends ObjectT = ObjectT>(value?: T) => ObjectT extends NotReadonly<T> ? "any" : NotReadonly<T
|
|
3
|
-
|
|
2
|
+
export declare const any: import("..").FnBasic<(<const T extends ObjectT = ObjectT>(value?: T) => ObjectT extends NotReadonly<T> ? "any" : NotReadonly<T>), object & {
|
|
3
|
+
const: "any";
|
|
4
|
+
type: "any";
|
|
5
|
+
}>;
|
package/lib/helpers/any.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { expandFn2 } from "../utils/expandFn.js";
|
|
1
3
|
//#region src/helpers/any.ts
|
|
2
|
-
const any = (value) => {
|
|
3
|
-
return value;
|
|
4
|
-
};
|
|
4
|
+
const any = expandFn2((value) => {
|
|
5
|
+
return standardize2(value);
|
|
6
|
+
}, "any");
|
|
5
7
|
//#endregion
|
|
6
8
|
export { any };
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=any.js.map
|
package/lib/helpers/array.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
|
+
const require_utils_index = require("../utils/index.cjs");
|
|
3
5
|
//#region src/helpers/array.ts
|
|
4
|
-
const array = (value) => {
|
|
5
|
-
return
|
|
6
|
-
};
|
|
6
|
+
const array = require_utils_expandFn.expandFn2((value) => {
|
|
7
|
+
return require_standard.standardize2([value]);
|
|
8
|
+
}, require_utils_index._const());
|
|
7
9
|
//#endregion
|
|
8
10
|
exports.array = array;
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=array.cjs.map
|
package/lib/helpers/array.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ArrayCustom, ObjectT } from "../types";
|
|
2
|
-
declare const array: <T extends ObjectT>(value: T) => ArrayCustom<T
|
|
3
|
-
|
|
2
|
+
export declare const array: import("..").FnBasic<(<T extends ObjectT>(value: T) => ArrayCustom<T>), object & {
|
|
3
|
+
const: ArrayCustom;
|
|
4
|
+
type: ArrayCustom;
|
|
5
|
+
}>;
|
package/lib/helpers/array.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
+
import { _const } from "../utils/index.js";
|
|
2
4
|
//#region src/helpers/array.ts
|
|
3
|
-
const array = (value) => {
|
|
4
|
-
return
|
|
5
|
-
};
|
|
5
|
+
const array = expandFn2((value) => {
|
|
6
|
+
return standardize2([value]);
|
|
7
|
+
}, _const());
|
|
6
8
|
//#endregion
|
|
7
9
|
export { array };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=array.js.map
|
package/lib/helpers/custom.cjs
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
3
4
|
//#region src/helpers/custom.ts
|
|
4
|
-
|
|
5
|
+
require("../utils/index.cjs")._const("any");
|
|
6
|
+
/**
|
|
7
|
+
* Create a custom value that can be used in the state value or as a literal.
|
|
8
|
+
* @param value The value to create the custom value from.
|
|
9
|
+
* @returns A custom value that can be used in the state value or as a literal.
|
|
10
|
+
*
|
|
11
|
+
* @important the type parameter `T` must not inherit of type {@link ObjectT}, otherwise it will be considered as an object and do not transform it in {@link type}
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const myCustomValue = custom({ foo: 'bar' });
|
|
16
|
+
* // myCustomValue is of type Custom<{ foo: 'bar }>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @see {@link Custom} for more information about custom values.
|
|
20
|
+
*/
|
|
21
|
+
const custom = require_utils_expandFn.expandFn2((value) => {
|
|
22
|
+
return require_standard.standardize2(value);
|
|
23
|
+
}, "any");
|
|
5
24
|
//#endregion
|
|
6
25
|
exports.custom = custom;
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=custom.cjs.map
|
package/lib/helpers/custom.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
import type { Custom } from "../types";
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Custom, ObjectT } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Create a custom value that can be used in the state value or as a literal.
|
|
4
|
+
* @param value The value to create the custom value from.
|
|
5
|
+
* @returns A custom value that can be used in the state value or as a literal.
|
|
6
|
+
*
|
|
7
|
+
* @important the type parameter `T` must not inherit of type {@link ObjectT}, otherwise it will be considered as an object and do not transform it in {@link type}
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const myCustomValue = custom({ foo: 'bar' });
|
|
12
|
+
* // myCustomValue is of type Custom<{ foo: 'bar }>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @see {@link Custom} for more information about custom values.
|
|
16
|
+
*/
|
|
17
|
+
export declare const custom: import("..").FnBasic<(<const T = any>(value?: T) => ObjectT extends T ? "any" : Custom<T>), object & {
|
|
18
|
+
const: "any";
|
|
19
|
+
type: "any";
|
|
20
|
+
}>;
|
package/lib/helpers/custom.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
+
import { _const } from "../utils/index.js";
|
|
2
4
|
//#region src/helpers/custom.ts
|
|
3
|
-
|
|
5
|
+
_const("any");
|
|
6
|
+
/**
|
|
7
|
+
* Create a custom value that can be used in the state value or as a literal.
|
|
8
|
+
* @param value The value to create the custom value from.
|
|
9
|
+
* @returns A custom value that can be used in the state value or as a literal.
|
|
10
|
+
*
|
|
11
|
+
* @important the type parameter `T` must not inherit of type {@link ObjectT}, otherwise it will be considered as an object and do not transform it in {@link type}
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const myCustomValue = custom({ foo: 'bar' });
|
|
16
|
+
* // myCustomValue is of type Custom<{ foo: 'bar }>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @see {@link Custom} for more information about custom values.
|
|
20
|
+
*/
|
|
21
|
+
const custom = expandFn2((value) => {
|
|
22
|
+
return standardize2(value);
|
|
23
|
+
}, "any");
|
|
4
24
|
//#endregion
|
|
5
25
|
export { custom };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=custom.js.map
|
package/lib/helpers/index.cjs
CHANGED
|
@@ -1,50 +1,26 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
const require_helpers_readonly = require("./readonly.cjs");
|
|
4
2
|
const require_helpers_any = require("./any.cjs");
|
|
5
3
|
const require_helpers_array = require("./array.cjs");
|
|
6
4
|
const require_helpers_custom = require("./custom.cjs");
|
|
7
5
|
const require_helpers_intersection = require("./intersection.cjs");
|
|
6
|
+
const require_helpers_union = require("./union.cjs");
|
|
8
7
|
const require_helpers_litterals = require("./litterals.cjs");
|
|
9
8
|
const require_helpers_optional = require("./optional.cjs");
|
|
10
9
|
const require_helpers_partial = require("./partial.cjs");
|
|
11
10
|
const require_helpers_primitive = require("./primitive.cjs");
|
|
12
11
|
const require_helpers_primitiveObject = require("./primitiveObject.cjs");
|
|
12
|
+
const require_helpers_readonly = require("./readonly.cjs");
|
|
13
|
+
const require_helpers_object = require("./object.cjs");
|
|
13
14
|
const require_helpers_record = require("./record.cjs");
|
|
14
15
|
const require_helpers_soa = require("./soa.cjs");
|
|
15
16
|
const require_helpers_sv = require("./sv.cjs");
|
|
16
17
|
const require_helpers_tuple = require("./tuple.cjs");
|
|
17
|
-
const require_helpers_union = require("./union.cjs");
|
|
18
|
-
//#region src/helpers/index.ts
|
|
19
|
-
var helpers_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
20
|
-
any: () => require_helpers_any.any,
|
|
21
|
-
array: () => require_helpers_array.array,
|
|
22
|
-
custom: () => require_helpers_custom.custom,
|
|
23
|
-
intersection: () => require_helpers_intersection.intersection,
|
|
24
|
-
litterals: () => require_helpers_litterals.litterals,
|
|
25
|
-
optional: () => require_helpers_optional.optional,
|
|
26
|
-
partial: () => require_helpers_partial.partial,
|
|
27
|
-
primitive: () => require_helpers_primitive.primitive,
|
|
28
|
-
primitiveObject: () => require_helpers_primitiveObject.primitiveObject,
|
|
29
|
-
readonly: () => require_helpers_readonly.readonly,
|
|
30
|
-
record: () => require_helpers_record.record,
|
|
31
|
-
soa: () => require_helpers_soa.soa,
|
|
32
|
-
sv: () => require_helpers_sv.sv,
|
|
33
|
-
tuple: () => require_helpers_tuple.tuple,
|
|
34
|
-
union: () => require_helpers_union.union
|
|
35
|
-
});
|
|
36
|
-
//#endregion
|
|
37
18
|
exports.any = require_helpers_any.any;
|
|
38
19
|
exports.array = require_helpers_array.array;
|
|
39
20
|
exports.custom = require_helpers_custom.custom;
|
|
40
|
-
Object.defineProperty(exports, "helpers_exports", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function() {
|
|
43
|
-
return helpers_exports;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
21
|
exports.intersection = require_helpers_intersection.intersection;
|
|
47
22
|
exports.litterals = require_helpers_litterals.litterals;
|
|
23
|
+
exports.object = require_helpers_object.object;
|
|
48
24
|
exports.optional = require_helpers_optional.optional;
|
|
49
25
|
exports.partial = require_helpers_partial.partial;
|
|
50
26
|
exports.primitive = require_helpers_primitive.primitive;
|
|
@@ -55,5 +31,3 @@ exports.soa = require_helpers_soa.soa;
|
|
|
55
31
|
exports.sv = require_helpers_sv.sv;
|
|
56
32
|
exports.tuple = require_helpers_tuple.tuple;
|
|
57
33
|
exports.union = require_helpers_union.union;
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=index.cjs.map
|
package/lib/helpers/index.d.ts
CHANGED
package/lib/helpers/index.js
CHANGED
|
@@ -1,38 +1,17 @@
|
|
|
1
|
-
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { readonly } from "./readonly.js";
|
|
3
1
|
import { any } from "./any.js";
|
|
4
2
|
import { array } from "./array.js";
|
|
5
3
|
import { custom } from "./custom.js";
|
|
6
4
|
import { intersection } from "./intersection.js";
|
|
5
|
+
import { union } from "./union.js";
|
|
7
6
|
import { litterals } from "./litterals.js";
|
|
8
7
|
import { optional } from "./optional.js";
|
|
9
8
|
import { partial } from "./partial.js";
|
|
10
9
|
import { primitive } from "./primitive.js";
|
|
11
10
|
import { primitiveObject } from "./primitiveObject.js";
|
|
11
|
+
import { readonly } from "./readonly.js";
|
|
12
|
+
import { object } from "./object.js";
|
|
12
13
|
import { record } from "./record.js";
|
|
13
14
|
import { soa } from "./soa.js";
|
|
14
15
|
import { sv } from "./sv.js";
|
|
15
16
|
import { tuple } from "./tuple.js";
|
|
16
|
-
|
|
17
|
-
//#region src/helpers/index.ts
|
|
18
|
-
var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
19
|
-
any: () => any,
|
|
20
|
-
array: () => array,
|
|
21
|
-
custom: () => custom,
|
|
22
|
-
intersection: () => intersection,
|
|
23
|
-
litterals: () => litterals,
|
|
24
|
-
optional: () => optional,
|
|
25
|
-
partial: () => partial,
|
|
26
|
-
primitive: () => primitive,
|
|
27
|
-
primitiveObject: () => primitiveObject,
|
|
28
|
-
readonly: () => readonly,
|
|
29
|
-
record: () => record,
|
|
30
|
-
soa: () => soa,
|
|
31
|
-
sv: () => sv,
|
|
32
|
-
tuple: () => tuple,
|
|
33
|
-
union: () => union
|
|
34
|
-
});
|
|
35
|
-
//#endregion
|
|
36
|
-
export { any, array, custom, helpers_exports, intersection, litterals, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
|
17
|
+
export { any, array, custom, intersection, litterals, object, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union };
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
2
3
|
//#region src/helpers/intersection.ts
|
|
3
4
|
const intersection = (...values) => {
|
|
4
|
-
return
|
|
5
|
-
Object.entries(curr).forEach(([key, value]) => {
|
|
6
|
-
acc[key] = value;
|
|
7
|
-
});
|
|
8
|
-
return acc;
|
|
9
|
-
}, {});
|
|
5
|
+
return require_standard.standardize2(values);
|
|
10
6
|
};
|
|
11
7
|
//#endregion
|
|
12
8
|
exports.intersection = intersection;
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=intersection.cjs.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { IntersectionCustom, NotReadonly, ObjectMapS } from "../types";
|
|
2
|
-
declare const intersection: <const T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(...values: T) => IntersectionCustom<NotReadonly<T>>;
|
|
3
|
-
export { intersection };
|
|
2
|
+
export declare const intersection: <const T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(...values: T) => IntersectionCustom<NotReadonly<T>>;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
1
2
|
//#region src/helpers/intersection.ts
|
|
2
3
|
const intersection = (...values) => {
|
|
3
|
-
return values
|
|
4
|
-
Object.entries(curr).forEach(([key, value]) => {
|
|
5
|
-
acc[key] = value;
|
|
6
|
-
});
|
|
7
|
-
return acc;
|
|
8
|
-
}, {});
|
|
4
|
+
return standardize2(values);
|
|
9
5
|
};
|
|
10
6
|
//#endregion
|
|
11
7
|
export { intersection };
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=intersection.js.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
|
+
const require_utils_index = require("../utils/index.cjs");
|
|
5
|
+
const require_helpers_union = require("./union.cjs");
|
|
2
6
|
//#region src/helpers/litterals.ts
|
|
3
|
-
const litterals = (...values) =>
|
|
7
|
+
const litterals = require_utils_expandFn.expandFn2((...values) => {
|
|
8
|
+
return require_standard.standardize2(values[0]);
|
|
9
|
+
}, require_utils_index._const(require_helpers_union.union("string", "number", "boolean")));
|
|
4
10
|
//#endregion
|
|
5
11
|
exports.litterals = litterals;
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=litterals.cjs.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Custom } from "../types";
|
|
2
|
-
declare const litterals: <const T extends (string | number | boolean)[]>(...values: T) => Custom<T[number]
|
|
3
|
-
|
|
2
|
+
export declare const litterals: import("..").FnBasic<(<const T extends (string | number | boolean)[]>(...values: T) => Custom<T[number]>), object & {
|
|
3
|
+
const: "string" | "number" | "boolean";
|
|
4
|
+
type: "string" | "number" | "boolean";
|
|
5
|
+
}>;
|
package/lib/helpers/litterals.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
+
import { _const } from "../utils/index.js";
|
|
4
|
+
import { union } from "./union.js";
|
|
1
5
|
//#region src/helpers/litterals.ts
|
|
2
|
-
const litterals = (...values) =>
|
|
6
|
+
const litterals = expandFn2((...values) => {
|
|
7
|
+
return standardize2(values[0]);
|
|
8
|
+
}, _const(union("string", "number", "boolean")));
|
|
3
9
|
//#endregion
|
|
4
10
|
export { litterals };
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=litterals.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
|
+
const require_utils_index = require("../utils/index.cjs");
|
|
5
|
+
//#region src/helpers/object.ts
|
|
6
|
+
const object = require_utils_expandFn.expandFn2((value) => {
|
|
7
|
+
return require_standard.standardize2(value);
|
|
8
|
+
}, require_utils_index._const());
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.object = object;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NotReadonly, ObjectMapS } from "../types";
|
|
2
|
+
export declare const object: import("..").FnBasic<(<const T extends ObjectMapS>(value?: T) => ObjectMapS extends NotReadonly<T> ? ObjectMapS : NotReadonly<T>), object & {
|
|
3
|
+
const: ObjectMapS;
|
|
4
|
+
type: ObjectMapS;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
+
import { _const } from "../utils/index.js";
|
|
4
|
+
//#region src/helpers/object.ts
|
|
5
|
+
const object = expandFn2((value) => {
|
|
6
|
+
return standardize2(value);
|
|
7
|
+
}, _const());
|
|
8
|
+
//#endregion
|
|
9
|
+
export { object };
|
package/lib/helpers/optional.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
3
|
//#region src/helpers/optional.ts
|
|
4
|
-
const optional = (value) =>
|
|
4
|
+
const optional = (value) => {
|
|
5
|
+
return require_standard.standardize2(value);
|
|
6
|
+
};
|
|
5
7
|
//#endregion
|
|
6
8
|
exports.optional = optional;
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=optional.cjs.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const optional: <const T extends
|
|
3
|
-
export { optional };
|
|
1
|
+
import type { CanOptional, NotReadonly, Optional } from "../types";
|
|
2
|
+
export declare const optional: <const T extends CanOptional>(value?: T) => Optional<NotReadonly<T>>;
|
package/lib/helpers/optional.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
2
|
//#region src/helpers/optional.ts
|
|
3
|
-
const optional = (value) =>
|
|
3
|
+
const optional = (value) => {
|
|
4
|
+
return standardize2(value);
|
|
5
|
+
};
|
|
4
6
|
//#endregion
|
|
5
7
|
export { optional };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=optional.js.map
|
package/lib/helpers/partial.cjs
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
3
|
//#region src/helpers/partial.ts
|
|
4
4
|
const partial = (value) => {
|
|
5
|
-
|
|
6
|
-
const out = {};
|
|
7
|
-
entries.forEach(([key, value]) => {
|
|
8
|
-
out[key] = value;
|
|
9
|
-
});
|
|
10
|
-
return out;
|
|
5
|
+
return require_standard.standardize2(value);
|
|
11
6
|
};
|
|
12
7
|
//#endregion
|
|
13
8
|
exports.partial = partial;
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=partial.cjs.map
|
package/lib/helpers/partial.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { NotReadonly, ObjectT, PartialCustom } from "../types";
|
|
2
|
-
declare const partial: <const T extends ObjectT>(value: T) => NotReadonly<T> & PartialCustom;
|
|
3
|
-
export { partial };
|
|
2
|
+
export declare const partial: <const T extends ObjectT>(value: T) => NotReadonly<T> & PartialCustom;
|
package/lib/helpers/partial.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
2
|
//#region src/helpers/partial.ts
|
|
3
3
|
const partial = (value) => {
|
|
4
|
-
|
|
5
|
-
const out = {};
|
|
6
|
-
entries.forEach(([key, value]) => {
|
|
7
|
-
out[key] = value;
|
|
8
|
-
});
|
|
9
|
-
return out;
|
|
4
|
+
return standardize2(value);
|
|
10
5
|
};
|
|
11
6
|
//#endregion
|
|
12
7
|
export { partial };
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=partial.js.map
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
|
+
const require_utils_index = require("../utils/index.cjs");
|
|
2
5
|
//#region src/helpers/primitive.ts
|
|
3
|
-
const primitive =
|
|
4
|
-
boolean: (value) => {
|
|
5
|
-
return value;
|
|
6
|
-
},
|
|
7
|
-
string: (value) => {
|
|
8
|
-
return value;
|
|
9
|
-
},
|
|
10
|
-
number: (value) => {
|
|
11
|
-
return value;
|
|
12
|
-
},
|
|
13
|
-
bigint: (value) => {
|
|
14
|
-
return value;
|
|
15
|
-
},
|
|
16
|
-
symbol: (value) => {
|
|
17
|
-
return value;
|
|
18
|
-
},
|
|
19
|
-
never: ()
|
|
20
|
-
undefined: ()
|
|
6
|
+
const primitive = require_utils_expandFn.expandFn2((value) => require_standard.standardize2(value), require_utils_index._const(), {
|
|
7
|
+
boolean: require_utils_expandFn.expandFn2((value) => {
|
|
8
|
+
return require_standard.standardize2(value);
|
|
9
|
+
}, "boolean"),
|
|
10
|
+
string: require_utils_expandFn.expandFn2((value) => {
|
|
11
|
+
return require_standard.standardize2(value);
|
|
12
|
+
}, "string"),
|
|
13
|
+
number: require_utils_expandFn.expandFn2((value) => {
|
|
14
|
+
return require_standard.standardize2(value);
|
|
15
|
+
}, "number"),
|
|
16
|
+
bigint: require_utils_expandFn.expandFn2((value) => {
|
|
17
|
+
return require_standard.standardize2(value);
|
|
18
|
+
}, "bigint"),
|
|
19
|
+
symbol: require_utils_expandFn.expandFn2((value) => {
|
|
20
|
+
return require_standard.standardize2(value);
|
|
21
|
+
}, "symbol"),
|
|
22
|
+
never: require_standard.standardize2(),
|
|
23
|
+
undefined: require_standard.standardize2()
|
|
21
24
|
});
|
|
22
25
|
//#endregion
|
|
23
26
|
exports.primitive = primitive;
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=primitive.cjs.map
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import type { Custom, PrimitiveT } from "../types";
|
|
2
2
|
export declare const primitive: import("..").FnBasic<(<const T extends PrimitiveT>(value?: T) => T), {
|
|
3
|
-
readonly boolean: <const T extends boolean>(value?: T) => boolean extends T ? "boolean" : Custom<T
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
readonly boolean: import("..").FnBasic<(<const T extends boolean>(value?: T) => boolean extends T ? "boolean" : Custom<T>), object & {
|
|
4
|
+
const: "boolean";
|
|
5
|
+
type: "boolean";
|
|
6
|
+
}>;
|
|
7
|
+
readonly string: import("..").FnBasic<(<const T extends string = string>(value?: T) => string extends T ? "string" : Custom<T>), object & {
|
|
8
|
+
const: "string";
|
|
9
|
+
type: "string";
|
|
10
|
+
}>;
|
|
11
|
+
readonly number: import("..").FnBasic<(<const T extends number = number>(value?: T) => number extends T ? "number" : Custom<T>), object & {
|
|
12
|
+
const: "number";
|
|
13
|
+
type: "number";
|
|
14
|
+
}>;
|
|
15
|
+
readonly bigint: import("..").FnBasic<(<const T extends bigint = bigint>(value?: T) => bigint extends T ? "bigint" : Custom<T>), object & {
|
|
16
|
+
const: "bigint";
|
|
17
|
+
type: "bigint";
|
|
18
|
+
}>;
|
|
19
|
+
readonly symbol: import("..").FnBasic<(<const T extends symbol = symbol>(value?: T) => symbol extends T ? "symbol" : Custom<T>), object & {
|
|
20
|
+
const: "symbol";
|
|
21
|
+
type: "symbol";
|
|
22
|
+
}>;
|
|
23
|
+
readonly never: Custom<never>;
|
|
24
|
+
readonly undefined: Custom<undefined>;
|
|
25
|
+
} & {
|
|
26
|
+
const: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "null" | "never" | "primitive";
|
|
27
|
+
type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "null" | "never" | "primitive";
|
|
10
28
|
}>;
|