@bemedev/typings 0.5.5 → 1.0.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/README.md +6 -1
- package/lib/constants.cjs +2 -0
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +2 -1
- package/lib/helpers/any.d.ts +1 -1
- package/lib/helpers/array.cjs +3 -4
- package/lib/helpers/array.js +1 -1
- package/lib/helpers/custom.cjs +1 -3
- package/lib/helpers/custom.d.ts +1 -1
- package/lib/helpers/custom.js +0 -2
- package/lib/helpers/index.cjs +4 -0
- package/lib/helpers/index.d.ts +2 -0
- package/lib/helpers/index.js +3 -1
- package/lib/helpers/litterals.cjs +2 -2
- package/lib/helpers/litterals.js +1 -1
- package/lib/helpers/object.cjs +3 -4
- package/lib/helpers/object.d.ts +1 -1
- package/lib/helpers/object.js +1 -1
- package/lib/helpers/omit.cjs +11 -0
- package/lib/helpers/omit.d.ts +7 -0
- package/lib/helpers/omit.js +11 -0
- package/lib/helpers/partial.d.ts +1 -1
- package/lib/helpers/primitive.cjs +2 -2
- package/lib/helpers/primitive.js +1 -1
- package/lib/helpers/primitiveObject.cjs +3 -3
- package/lib/helpers/primitiveObject.js +1 -1
- package/lib/helpers/sora.d.ts +1 -1
- package/lib/helpers/sv.cjs +3 -4
- package/lib/helpers/sv.js +1 -1
- package/lib/helpers/use.cjs +5 -0
- package/lib/helpers/use.d.ts +2 -0
- package/lib/helpers/use.js +4 -0
- package/lib/index.cjs +2 -0
- package/lib/index.js +3 -3
- package/lib/standard.cjs +7 -6
- package/lib/standard.d.ts +2 -1
- package/lib/standard.js +8 -7
- package/lib/standard.types.d.ts +3 -61
- package/lib/type.cjs +7 -1
- package/lib/type.d.ts +5 -1
- package/lib/type.js +7 -2
- package/lib/types.d.ts +17 -12
- package/lib/utils/_const.cjs +5 -0
- package/lib/utils/_const.d.ts +2 -0
- package/lib/utils/_const.js +4 -0
- package/lib/utils/index.cjs +4 -4
- package/lib/utils/index.d.ts +3 -3
- package/lib/utils/index.js +3 -4
- package/lib/utils/isSh.cjs +10 -0
- package/lib/utils/isSh.d.ts +2 -0
- package/lib/utils/isSh.js +9 -0
- package/package.json +20 -15
package/README.md
CHANGED
|
@@ -47,12 +47,17 @@ expectTypeOf(result).toEqualTypeOf<{
|
|
|
47
47
|
- `custom`: Custom type
|
|
48
48
|
- `intersection`: Intersection of types
|
|
49
49
|
- `litterals`: Literal types
|
|
50
|
+
- `object`: Object schema helper
|
|
51
|
+
- `omit`: Omit specific keys from an object
|
|
50
52
|
- `optional`: Optional types
|
|
51
53
|
- `partial`: Partial types
|
|
54
|
+
- `primitive`: Primitive type definitions
|
|
52
55
|
- `primitiveObject`: Primitive object schema
|
|
56
|
+
- `readonly`: Readonly object types
|
|
53
57
|
- `record`: Record types
|
|
54
58
|
- `soa`: Single or Array types
|
|
55
|
-
- `sora`: Single or Array types, with recursive support, (soa with
|
|
59
|
+
- `sora`: Single or Array types, with recursive support, (soa with
|
|
60
|
+
recursion)
|
|
56
61
|
- `sv`: State Value
|
|
57
62
|
- `tuple`: Tuple types
|
|
58
63
|
- `union`: Union types
|
package/lib/constants.cjs
CHANGED
|
@@ -26,6 +26,7 @@ const SOA = "$$app-ts => soa$$";
|
|
|
26
26
|
const SORA = "$$app-ts => sora$$";
|
|
27
27
|
const LITTERALS = "$$app-ts => litterals$$";
|
|
28
28
|
const STANDARD_KEY = "~standard";
|
|
29
|
+
const vendor = "@bemedev/typings";
|
|
29
30
|
//#endregion
|
|
30
31
|
exports.ARRAY = ARRAY;
|
|
31
32
|
exports.CUSTOM = CUSTOM;
|
|
@@ -38,3 +39,4 @@ exports.SOA = SOA;
|
|
|
38
39
|
exports.SORA = SORA;
|
|
39
40
|
exports.STANDARD_KEY = STANDARD_KEY;
|
|
40
41
|
exports.UNION = UNION;
|
|
42
|
+
exports.vendor = vendor;
|
package/lib/constants.d.ts
CHANGED
package/lib/constants.js
CHANGED
|
@@ -25,5 +25,6 @@ const SOA = "$$app-ts => soa$$";
|
|
|
25
25
|
const SORA = "$$app-ts => sora$$";
|
|
26
26
|
const LITTERALS = "$$app-ts => litterals$$";
|
|
27
27
|
const STANDARD_KEY = "~standard";
|
|
28
|
+
const vendor = "@bemedev/typings";
|
|
28
29
|
//#endregion
|
|
29
|
-
export { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION };
|
|
30
|
+
export { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION, vendor };
|
package/lib/helpers/any.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NotReadonly, ObjectT } from '../types';
|
|
2
|
-
export declare const any: import("..").FnBasic<(<const T extends ObjectT = ObjectT>(value?: T) => ObjectT extends
|
|
2
|
+
export declare const any: import("..").FnBasic<(<const T extends ObjectT = ObjectT>(value?: T) => ObjectT extends T ? "any" : NotReadonly<T>), object & {
|
|
3
3
|
const: "any";
|
|
4
4
|
type: "any";
|
|
5
5
|
}>;
|
package/lib/helpers/array.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_standard = require("../standard.cjs");
|
|
3
|
-
const
|
|
4
|
-
const require_utils_index = require("../utils/index.cjs");
|
|
3
|
+
const require_utils__const = require("../utils/_const.cjs");
|
|
5
4
|
//#region src/helpers/array.ts
|
|
6
|
-
const array =
|
|
5
|
+
const array = require("../utils/expandFn.cjs").expandFn2((value) => {
|
|
7
6
|
return require_standard.standardize2([value]);
|
|
8
|
-
},
|
|
7
|
+
}, require_utils__const._const());
|
|
9
8
|
//#endregion
|
|
10
9
|
exports.array = array;
|
package/lib/helpers/array.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { _const } from "../utils/_const.js";
|
|
2
3
|
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
-
import { _const } from "../utils/index.js";
|
|
4
4
|
//#region src/helpers/array.ts
|
|
5
5
|
const array = expandFn2((value) => {
|
|
6
6
|
return standardize2([value]);
|
package/lib/helpers/custom.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_standard = require("../standard.cjs");
|
|
3
|
-
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
3
|
//#region src/helpers/custom.ts
|
|
5
|
-
require("../utils/index.cjs")._const("any");
|
|
6
4
|
/**
|
|
7
5
|
* Create a custom value that can be used in the state value or as a literal.
|
|
8
6
|
* @param value The value to create the custom value from.
|
|
@@ -18,7 +16,7 @@ require("../utils/index.cjs")._const("any");
|
|
|
18
16
|
*
|
|
19
17
|
* @see {@link Custom} for more information about custom values.
|
|
20
18
|
*/
|
|
21
|
-
const custom =
|
|
19
|
+
const custom = require("../utils/expandFn.cjs").expandFn2((value) => {
|
|
22
20
|
return require_standard.standardize2(value);
|
|
23
21
|
}, "any");
|
|
24
22
|
//#endregion
|
package/lib/helpers/custom.d.ts
CHANGED
package/lib/helpers/custom.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { standardize2 } from "../standard.js";
|
|
2
2
|
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
-
import { _const } from "../utils/index.js";
|
|
4
3
|
//#region src/helpers/custom.ts
|
|
5
|
-
_const("any");
|
|
6
4
|
/**
|
|
7
5
|
* Create a custom value that can be used in the state value or as a literal.
|
|
8
6
|
* @param value The value to create the custom value from.
|
package/lib/helpers/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_helpers_any = require("./any.cjs");
|
|
|
3
3
|
const require_helpers_array = require("./array.cjs");
|
|
4
4
|
const require_helpers_custom = require("./custom.cjs");
|
|
5
5
|
const require_helpers_intersection = require("./intersection.cjs");
|
|
6
|
+
const require_helpers_use = require("./use.cjs");
|
|
6
7
|
const require_helpers_union = require("./union.cjs");
|
|
7
8
|
const require_helpers_litterals = require("./litterals.cjs");
|
|
8
9
|
const require_helpers_optional = require("./optional.cjs");
|
|
@@ -16,12 +17,14 @@ const require_helpers_soa = require("./soa.cjs");
|
|
|
16
17
|
const require_helpers_sora = require("./sora.cjs");
|
|
17
18
|
const require_helpers_sv = require("./sv.cjs");
|
|
18
19
|
const require_helpers_tuple = require("./tuple.cjs");
|
|
20
|
+
const require_helpers_omit = require("./omit.cjs");
|
|
19
21
|
exports.any = require_helpers_any.any;
|
|
20
22
|
exports.array = require_helpers_array.array;
|
|
21
23
|
exports.custom = require_helpers_custom.custom;
|
|
22
24
|
exports.intersection = require_helpers_intersection.intersection;
|
|
23
25
|
exports.litterals = require_helpers_litterals.litterals;
|
|
24
26
|
exports.object = require_helpers_object.object;
|
|
27
|
+
exports.omit = require_helpers_omit.omit;
|
|
25
28
|
exports.optional = require_helpers_optional.optional;
|
|
26
29
|
exports.partial = require_helpers_partial.partial;
|
|
27
30
|
exports.primitive = require_helpers_primitive.primitive;
|
|
@@ -33,3 +36,4 @@ exports.sora = require_helpers_sora.sora;
|
|
|
33
36
|
exports.sv = require_helpers_sv.sv;
|
|
34
37
|
exports.tuple = require_helpers_tuple.tuple;
|
|
35
38
|
exports.union = require_helpers_union.union;
|
|
39
|
+
exports.use = require_helpers_use.use;
|
package/lib/helpers/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./any";
|
|
|
2
2
|
export * from "./array";
|
|
3
3
|
export * from "./custom";
|
|
4
4
|
export * from "./intersection";
|
|
5
|
+
export * from "./use";
|
|
5
6
|
export * from "./litterals";
|
|
6
7
|
export * from "./optional";
|
|
7
8
|
export * from "./partial";
|
|
@@ -15,3 +16,4 @@ export * from "./sv";
|
|
|
15
16
|
export * from "./tuple";
|
|
16
17
|
export * from "./union";
|
|
17
18
|
export * from "./object";
|
|
19
|
+
export * from "./omit";
|
package/lib/helpers/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { any } from "./any.js";
|
|
|
2
2
|
import { array } from "./array.js";
|
|
3
3
|
import { custom } from "./custom.js";
|
|
4
4
|
import { intersection } from "./intersection.js";
|
|
5
|
+
import { use } from "./use.js";
|
|
5
6
|
import { union } from "./union.js";
|
|
6
7
|
import { litterals } from "./litterals.js";
|
|
7
8
|
import { optional } from "./optional.js";
|
|
@@ -15,4 +16,5 @@ import { soa } from "./soa.js";
|
|
|
15
16
|
import { sora } from "./sora.js";
|
|
16
17
|
import { sv } from "./sv.js";
|
|
17
18
|
import { tuple } from "./tuple.js";
|
|
18
|
-
|
|
19
|
+
import { omit } from "./omit.js";
|
|
20
|
+
export { any, array, custom, intersection, litterals, object, omit, optional, partial, primitive, primitiveObject, readonly, record, soa, sora, sv, tuple, union, use };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils__const = require("../utils/_const.cjs");
|
|
3
4
|
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
|
-
const require_utils_index = require("../utils/index.cjs");
|
|
5
5
|
const require_helpers_union = require("./union.cjs");
|
|
6
6
|
//#region src/helpers/litterals.ts
|
|
7
7
|
const litterals = require_utils_expandFn.expandFn2((...values) => {
|
|
8
8
|
return require_standard.standardize2(values[0]);
|
|
9
|
-
},
|
|
9
|
+
}, require_utils__const._const(require_helpers_union.union("string", "number", "boolean")));
|
|
10
10
|
//#endregion
|
|
11
11
|
exports.litterals = litterals;
|
package/lib/helpers/litterals.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { _const } from "../utils/_const.js";
|
|
2
3
|
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
-
import { _const } from "../utils/index.js";
|
|
4
4
|
import { union } from "./union.js";
|
|
5
5
|
//#region src/helpers/litterals.ts
|
|
6
6
|
const litterals = expandFn2((...values) => {
|
package/lib/helpers/object.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_standard = require("../standard.cjs");
|
|
3
|
-
const
|
|
4
|
-
const require_utils_index = require("../utils/index.cjs");
|
|
3
|
+
const require_utils__const = require("../utils/_const.cjs");
|
|
5
4
|
//#region src/helpers/object.ts
|
|
6
|
-
const object =
|
|
5
|
+
const object = require("../utils/expandFn.cjs").expandFn2((value) => {
|
|
7
6
|
return require_standard.standardize2(value);
|
|
8
|
-
},
|
|
7
|
+
}, require_utils__const._const());
|
|
9
8
|
//#endregion
|
|
10
9
|
exports.object = object;
|
package/lib/helpers/object.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NotReadonly, ObjectMapS } from '../types';
|
|
2
|
-
export declare const object: import("..").FnBasic<(<const T extends ObjectMapS>(value?: T) => ObjectMapS extends
|
|
2
|
+
export declare const object: import("..").FnBasic<(<const T extends ObjectMapS>(value?: T) => ObjectMapS extends T ? ObjectMapS : NotReadonly<T>), object & {
|
|
3
3
|
const: ObjectMapS;
|
|
4
4
|
type: ObjectMapS;
|
|
5
5
|
}>;
|
package/lib/helpers/object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { _const } from "../utils/_const.js";
|
|
2
3
|
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
-
import { _const } from "../utils/index.js";
|
|
4
4
|
//#region src/helpers/object.ts
|
|
5
5
|
const object = expandFn2((value) => {
|
|
6
6
|
return standardize2(value);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils__const = require("../utils/_const.cjs");
|
|
4
|
+
//#region src/helpers/omit.ts
|
|
5
|
+
const omit = require("../utils/expandFn.cjs").expandFn2((value, _) => {
|
|
6
|
+
return require_standard.standardize2(value);
|
|
7
|
+
}, require_utils__const._const(), { strict: (value, _) => {
|
|
8
|
+
return require_standard.standardize2(value);
|
|
9
|
+
} });
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.omit = omit;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Keys, NOmit, NotReadonly, ObjectMapS } from '../types';
|
|
2
|
+
export declare const omit: import("..").FnBasic<(<const T extends ObjectMapS, K extends Keys>(value: T, _: K) => ObjectMapS extends T ? ObjectMapS : Omit<NotReadonly<T>, K>), {
|
|
3
|
+
readonly strict: <const T extends ObjectMapS, const K extends keyof T = keyof T>(value: T, _: K) => ObjectMapS extends T ? ObjectMapS : NOmit<NotReadonly<T>, K>;
|
|
4
|
+
} & {
|
|
5
|
+
const: ObjectMapS;
|
|
6
|
+
type: ObjectMapS;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { _const } from "../utils/_const.js";
|
|
3
|
+
import { expandFn2 } from "../utils/expandFn.js";
|
|
4
|
+
//#region src/helpers/omit.ts
|
|
5
|
+
const omit = expandFn2((value, _) => {
|
|
6
|
+
return standardize2(value);
|
|
7
|
+
}, _const(), { strict: (value, _) => {
|
|
8
|
+
return standardize2(value);
|
|
9
|
+
} });
|
|
10
|
+
//#endregion
|
|
11
|
+
export { omit };
|
package/lib/helpers/partial.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NotReadonly, ObjectT, PartialCustom } from '../types';
|
|
2
|
-
export declare const partial: <const T extends ObjectT>(value: T) => NotReadonly<T
|
|
2
|
+
export declare const partial: <const T extends ObjectT>(value: T) => PartialCustom<NotReadonly<T>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils__const = require("../utils/_const.cjs");
|
|
3
4
|
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
|
-
const require_utils_index = require("../utils/index.cjs");
|
|
5
5
|
//#region src/helpers/primitive.ts
|
|
6
|
-
const primitive = require_utils_expandFn.expandFn2((value) => require_standard.standardize2(value),
|
|
6
|
+
const primitive = require_utils_expandFn.expandFn2((value) => require_standard.standardize2(value), require_utils__const._const(), {
|
|
7
7
|
boolean: require_utils_expandFn.expandFn2((value) => {
|
|
8
8
|
return require_standard.standardize2(value);
|
|
9
9
|
}, "boolean"),
|
package/lib/helpers/primitive.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { _const } from "../utils/_const.js";
|
|
2
3
|
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
-
import { _const } from "../utils/index.js";
|
|
4
4
|
//#region src/helpers/primitive.ts
|
|
5
5
|
const primitive = expandFn2((value) => standardize2(value), _const(), {
|
|
6
6
|
boolean: expandFn2((value) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_standard = require("../standard.cjs");
|
|
3
|
+
const require_utils__const = require("../utils/_const.cjs");
|
|
3
4
|
const require_utils_expandFn = require("../utils/expandFn.cjs");
|
|
4
|
-
const require_utils_index = require("../utils/index.cjs");
|
|
5
5
|
//#region src/helpers/primitiveObject.ts
|
|
6
6
|
const primitiveObject = require_utils_expandFn.expandFn2((value) => {
|
|
7
7
|
return require_standard.standardize2(value);
|
|
8
|
-
},
|
|
8
|
+
}, require_utils__const._const(), { map: require_utils_expandFn.expandFn2((value) => {
|
|
9
9
|
return require_standard.standardize2(value);
|
|
10
|
-
},
|
|
10
|
+
}, require_utils__const._const()) });
|
|
11
11
|
//#endregion
|
|
12
12
|
exports.primitiveObject = primitiveObject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { _const } from "../utils/_const.js";
|
|
2
3
|
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
-
import { _const } from "../utils/index.js";
|
|
4
4
|
//#region src/helpers/primitiveObject.ts
|
|
5
5
|
const primitiveObject = expandFn2((value) => {
|
|
6
6
|
return standardize2(value);
|
package/lib/helpers/sora.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { NotReadonly, ObjectT, SoRaCustom } from
|
|
1
|
+
import type { NotReadonly, ObjectT, SoRaCustom } from '../types';
|
|
2
2
|
export declare const sora: <const T extends ObjectT>(value?: T) => ObjectT extends NotReadonly<T> ? "any" : SoRaCustom<NotReadonly<T>>;
|
package/lib/helpers/sv.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_standard = require("../standard.cjs");
|
|
3
|
-
const
|
|
4
|
-
const require_utils_index = require("../utils/index.cjs");
|
|
3
|
+
const require_utils__const = require("../utils/_const.cjs");
|
|
5
4
|
//#region src/helpers/sv.ts
|
|
6
|
-
const sv =
|
|
5
|
+
const sv = require("../utils/expandFn.cjs").expandFn2((value) => {
|
|
7
6
|
return require_standard.standardize2(value);
|
|
8
|
-
},
|
|
7
|
+
}, require_utils__const._const());
|
|
9
8
|
//#endregion
|
|
10
9
|
exports.sv = sv;
|
package/lib/helpers/sv.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { standardize2 } from "../standard.js";
|
|
2
|
+
import { _const } from "../utils/_const.js";
|
|
2
3
|
import { expandFn2 } from "../utils/expandFn.js";
|
|
3
|
-
import { _const } from "../utils/index.js";
|
|
4
4
|
//#region src/helpers/sv.ts
|
|
5
5
|
const sv = expandFn2((value) => {
|
|
6
6
|
return standardize2(value);
|
package/lib/index.cjs
CHANGED
|
@@ -12,4 +12,6 @@ exports.SOA = require_constants.SOA;
|
|
|
12
12
|
exports.SORA = require_constants.SORA;
|
|
13
13
|
exports.STANDARD_KEY = require_constants.STANDARD_KEY;
|
|
14
14
|
exports.UNION = require_constants.UNION;
|
|
15
|
+
exports.pretype = require_type.pretype;
|
|
15
16
|
exports.type = require_type.type;
|
|
17
|
+
exports.vendor = require_constants.vendor;
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION } from "./constants.js";
|
|
2
|
-
import { type } from "./type.js";
|
|
3
|
-
export { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION, type };
|
|
1
|
+
import { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION, vendor } from "./constants.js";
|
|
2
|
+
import { pretype, type } from "./type.js";
|
|
3
|
+
export { ARRAY, CUSTOM, LITTERALS, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION, pretype, type, vendor };
|
package/lib/standard.cjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_constants = require("./constants.cjs");
|
|
3
3
|
//#region src/standard.ts
|
|
4
|
-
const _standardize = (
|
|
4
|
+
const _standardize = (__type) => {
|
|
5
5
|
return {
|
|
6
|
-
|
|
6
|
+
__type,
|
|
7
|
+
type: __type,
|
|
7
8
|
[require_constants.STANDARD_KEY]: {
|
|
8
9
|
version: 1,
|
|
9
|
-
vendor:
|
|
10
|
+
vendor: require_constants.vendor,
|
|
10
11
|
types: {
|
|
11
|
-
input:
|
|
12
|
-
output:
|
|
12
|
+
input: __type,
|
|
13
|
+
output: __type
|
|
13
14
|
},
|
|
14
|
-
validate: () => ({ value })
|
|
15
|
+
validate: () => ({ value: __type })
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
};
|
package/lib/standard.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from "./standard.types";
|
|
2
2
|
type Standardize_F = <T>(value: T) => {
|
|
3
|
-
|
|
3
|
+
__type: T;
|
|
4
|
+
type: T;
|
|
4
5
|
} & StandardSchemaV1<T, T>;
|
|
5
6
|
export declare const standardize: Standardize_F;
|
|
6
7
|
export declare const standardize2: <T>(value?: unknown) => T;
|
package/lib/standard.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { STANDARD_KEY } from "./constants.js";
|
|
1
|
+
import { STANDARD_KEY, vendor } from "./constants.js";
|
|
2
2
|
//#region src/standard.ts
|
|
3
|
-
const _standardize = (
|
|
3
|
+
const _standardize = (__type) => {
|
|
4
4
|
return {
|
|
5
|
-
|
|
5
|
+
__type,
|
|
6
|
+
type: __type,
|
|
6
7
|
[STANDARD_KEY]: {
|
|
7
8
|
version: 1,
|
|
8
|
-
vendor
|
|
9
|
+
vendor,
|
|
9
10
|
types: {
|
|
10
|
-
input:
|
|
11
|
-
output:
|
|
11
|
+
input: __type,
|
|
12
|
+
output: __type
|
|
12
13
|
},
|
|
13
|
-
validate: () => ({ value })
|
|
14
|
+
validate: () => ({ value: __type })
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
17
|
};
|
package/lib/standard.types.d.ts
CHANGED
|
@@ -1,61 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
5
|
-
/** The Standard Schema properties. */
|
|
6
|
-
readonly [STANDARD_KEY]: StandardSchemaV1.Props<Input, Output>;
|
|
7
|
-
}
|
|
8
|
-
export declare namespace StandardSchemaV1 {
|
|
9
|
-
/** The Standard Schema properties interface. */
|
|
10
|
-
interface Props<Input = unknown, Output = Input> {
|
|
11
|
-
/** The version number of the standard. */
|
|
12
|
-
readonly version: 1;
|
|
13
|
-
/** The vendor name of the schema library. */
|
|
14
|
-
readonly vendor: string;
|
|
15
|
-
/** Validates unknown input values. */
|
|
16
|
-
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
17
|
-
/** Inferred types associated with the schema. */
|
|
18
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
19
|
-
}
|
|
20
|
-
/** The result interface of the validate function. */
|
|
21
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
22
|
-
/** The result interface if validation succeeds. */
|
|
23
|
-
interface SuccessResult<Output> {
|
|
24
|
-
/** The typed output value. */
|
|
25
|
-
readonly value: Output;
|
|
26
|
-
/** A falsy value for `issues` indicates success. */
|
|
27
|
-
readonly issues?: undefined;
|
|
28
|
-
}
|
|
29
|
-
interface Options {
|
|
30
|
-
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
31
|
-
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
32
|
-
}
|
|
33
|
-
/** The result interface if validation fails. */
|
|
34
|
-
interface FailureResult {
|
|
35
|
-
/** The issues of failed validation. */
|
|
36
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
37
|
-
}
|
|
38
|
-
/** The issue interface of the failure output. */
|
|
39
|
-
interface Issue {
|
|
40
|
-
/** The error message of the issue. */
|
|
41
|
-
readonly message: string;
|
|
42
|
-
/** The path of the issue, if any. */
|
|
43
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
44
|
-
}
|
|
45
|
-
/** The path segment interface of the issue. */
|
|
46
|
-
interface PathSegment {
|
|
47
|
-
/** The key representing a path segment. */
|
|
48
|
-
readonly key: PropertyKey;
|
|
49
|
-
}
|
|
50
|
-
/** The Standard Schema types interface. */
|
|
51
|
-
interface Types<Input = unknown, Output = Input> {
|
|
52
|
-
/** The input type of the schema. */
|
|
53
|
-
readonly input: Input;
|
|
54
|
-
/** The output type of the schema. */
|
|
55
|
-
readonly output: Output;
|
|
56
|
-
}
|
|
57
|
-
/** Infers the input type of a Standard Schema. */
|
|
58
|
-
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema[StandardKey]["types"]>["input"];
|
|
59
|
-
/** Infers the output type of a Standard Schema. */
|
|
60
|
-
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema[StandardKey]["types"]>["output"];
|
|
61
|
-
}
|
|
1
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
export type * from "@standard-schema/spec";
|
|
3
|
+
export type StandardKey = keyof StandardSchemaV1;
|
package/lib/type.cjs
CHANGED
|
@@ -4,6 +4,7 @@ const require_helpers_any = require("./helpers/any.cjs");
|
|
|
4
4
|
const require_helpers_array = require("./helpers/array.cjs");
|
|
5
5
|
const require_helpers_custom = require("./helpers/custom.cjs");
|
|
6
6
|
const require_helpers_intersection = require("./helpers/intersection.cjs");
|
|
7
|
+
const require_helpers_use = require("./helpers/use.cjs");
|
|
7
8
|
const require_helpers_union = require("./helpers/union.cjs");
|
|
8
9
|
const require_helpers_litterals = require("./helpers/litterals.cjs");
|
|
9
10
|
const require_helpers_optional = require("./helpers/optional.cjs");
|
|
@@ -17,6 +18,7 @@ const require_helpers_soa = require("./helpers/soa.cjs");
|
|
|
17
18
|
const require_helpers_sora = require("./helpers/sora.cjs");
|
|
18
19
|
const require_helpers_sv = require("./helpers/sv.cjs");
|
|
19
20
|
const require_helpers_tuple = require("./helpers/tuple.cjs");
|
|
21
|
+
const require_helpers_omit = require("./helpers/omit.cjs");
|
|
20
22
|
require("./helpers/index.cjs");
|
|
21
23
|
//#region src/type.ts
|
|
22
24
|
const _transform = (obj) => {
|
|
@@ -31,6 +33,7 @@ const type = (option) => {
|
|
|
31
33
|
intersection: require_helpers_intersection.intersection,
|
|
32
34
|
litterals: require_helpers_litterals.litterals,
|
|
33
35
|
optional: require_helpers_optional.optional,
|
|
36
|
+
omit: require_helpers_omit.omit,
|
|
34
37
|
partial: require_helpers_partial.partial,
|
|
35
38
|
record: require_helpers_record.record,
|
|
36
39
|
soa: require_helpers_soa.soa,
|
|
@@ -42,10 +45,13 @@ const type = (option) => {
|
|
|
42
45
|
primitive: require_helpers_primitive.primitive,
|
|
43
46
|
readonly: require_helpers_readonly.readonly,
|
|
44
47
|
object: require_helpers_object.object,
|
|
45
|
-
sora: require_helpers_sora.sora
|
|
48
|
+
sora: require_helpers_sora.sora,
|
|
49
|
+
use: require_helpers_use.use
|
|
46
50
|
}));
|
|
47
51
|
else out = _transform(option);
|
|
48
52
|
return require_standard.standardize(out);
|
|
49
53
|
};
|
|
54
|
+
const pretype = () => type;
|
|
50
55
|
//#endregion
|
|
56
|
+
exports.pretype = pretype;
|
|
51
57
|
exports.type = type;
|
package/lib/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { inferSh, ObjectT } from "./types";
|
|
2
|
-
import { any, array, custom, intersection, litterals, object, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union, sora } from "./helpers";
|
|
2
|
+
import { any, array, custom, intersection, litterals, object, omit, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union, sora, use } from "./helpers";
|
|
3
3
|
type Helpers = {
|
|
4
4
|
any: typeof any;
|
|
5
5
|
custom: typeof custom;
|
|
@@ -9,6 +9,7 @@ type Helpers = {
|
|
|
9
9
|
partial: typeof partial;
|
|
10
10
|
record: typeof record;
|
|
11
11
|
soa: typeof soa;
|
|
12
|
+
use: typeof use;
|
|
12
13
|
sv: typeof sv;
|
|
13
14
|
union: typeof union;
|
|
14
15
|
array: typeof array;
|
|
@@ -17,8 +18,11 @@ type Helpers = {
|
|
|
17
18
|
primitive: typeof primitive;
|
|
18
19
|
readonly: typeof readonly;
|
|
19
20
|
object: typeof object;
|
|
21
|
+
omit: typeof omit;
|
|
20
22
|
sora: typeof sora;
|
|
21
23
|
};
|
|
22
24
|
export type Transform_F = <T extends ObjectT = ObjectT>(option?: ((helpers: Helpers) => T) | T) => inferSh<T>;
|
|
25
|
+
export type PreTransform = <U extends ObjectT>() => <T extends U = U>(option?: ((helpers: Helpers) => T) | T) => inferSh<T>;
|
|
23
26
|
export declare const type: Transform_F;
|
|
27
|
+
export declare const pretype: PreTransform;
|
|
24
28
|
export {};
|
package/lib/type.js
CHANGED
|
@@ -3,6 +3,7 @@ import { any } from "./helpers/any.js";
|
|
|
3
3
|
import { array } from "./helpers/array.js";
|
|
4
4
|
import { custom } from "./helpers/custom.js";
|
|
5
5
|
import { intersection } from "./helpers/intersection.js";
|
|
6
|
+
import { use } from "./helpers/use.js";
|
|
6
7
|
import { union } from "./helpers/union.js";
|
|
7
8
|
import { litterals } from "./helpers/litterals.js";
|
|
8
9
|
import { optional } from "./helpers/optional.js";
|
|
@@ -16,6 +17,7 @@ import { soa } from "./helpers/soa.js";
|
|
|
16
17
|
import { sora } from "./helpers/sora.js";
|
|
17
18
|
import { sv } from "./helpers/sv.js";
|
|
18
19
|
import { tuple } from "./helpers/tuple.js";
|
|
20
|
+
import { omit } from "./helpers/omit.js";
|
|
19
21
|
import "./helpers/index.js";
|
|
20
22
|
//#region src/type.ts
|
|
21
23
|
const _transform = (obj) => {
|
|
@@ -30,6 +32,7 @@ const type = (option) => {
|
|
|
30
32
|
intersection,
|
|
31
33
|
litterals,
|
|
32
34
|
optional,
|
|
35
|
+
omit,
|
|
33
36
|
partial,
|
|
34
37
|
record,
|
|
35
38
|
soa,
|
|
@@ -41,10 +44,12 @@ const type = (option) => {
|
|
|
41
44
|
primitive,
|
|
42
45
|
readonly,
|
|
43
46
|
object,
|
|
44
|
-
sora
|
|
47
|
+
sora,
|
|
48
|
+
use
|
|
45
49
|
}));
|
|
46
50
|
else out = _transform(option);
|
|
47
51
|
return standardize(out);
|
|
48
52
|
};
|
|
53
|
+
const pretype = () => type;
|
|
49
54
|
//#endregion
|
|
50
|
-
export { type };
|
|
55
|
+
export { pretype, type };
|
package/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, UNION } from "./constants";
|
|
2
2
|
import type { StandardKey, StandardSchemaV1 } from "./standard.types";
|
|
3
3
|
export type Ru = Record<Keys, unknown>;
|
|
4
|
+
type Equals<T, U> = T extends U ? (U extends T ? true : false) : false;
|
|
4
5
|
export type TrueObject = Ru & {
|
|
5
6
|
[Symbol.iterator]?: never;
|
|
6
7
|
};
|
|
@@ -42,9 +43,9 @@ export type SoRaCustom<T extends ObjectT = ObjectT> = {
|
|
|
42
43
|
export type UnionCustom<T extends ObjectT[] = ObjectT[]> = {
|
|
43
44
|
[UNION]: T;
|
|
44
45
|
};
|
|
45
|
-
export
|
|
46
|
-
[PARTIAL]:
|
|
47
|
-
}
|
|
46
|
+
export interface PartialCustom<T extends ObjectT = ObjectT> {
|
|
47
|
+
[PARTIAL]: T;
|
|
48
|
+
}
|
|
48
49
|
export type __ObjectT = Types | ObjectMapS | Custom | PartialCustom | PrimitiveObjectT;
|
|
49
50
|
export type CanOptional = __ObjectT | ArrayCustom | AnyArray<__ObjectT>;
|
|
50
51
|
export type Optional<T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT> = __ObjectT> = {
|
|
@@ -65,7 +66,7 @@ export type IntersectionCustom<T extends ObjectMapS[]> = T extends [
|
|
|
65
66
|
...infer Rest extends ObjectMapS[]
|
|
66
67
|
] ? First & IntersectionCustom<Rest> : unknown;
|
|
67
68
|
type _ObjectT = __ObjectT | Optional | ArrayCustom;
|
|
68
|
-
export type PrimitiveObjectT = SoRa<Types | PrimitiveObjectMapS | ArrayCustom<Types | PrimitiveObjectMapS> | Optional<Types | PrimitiveObjectMapS> | UnionCustom<Types[] | PrimitiveObjectMapS[]> |
|
|
69
|
+
export type PrimitiveObjectT = SoRa<Types | (PrimitiveObjectMapS & Partial<Record<typeof PARTIAL, never>>) | ArrayCustom<Types | PrimitiveObjectMapS> | Optional<Types | PrimitiveObjectMapS> | UnionCustom<Types[] | PrimitiveObjectMapS[]> | PartialCustom<PrimitiveObjectMapS>>;
|
|
69
70
|
export interface PrimitiveObjectMapS {
|
|
70
71
|
[key: Keys]: PrimitiveObjectT;
|
|
71
72
|
}
|
|
@@ -79,12 +80,14 @@ export type POS = ObjectT;
|
|
|
79
80
|
type ReduceTuple2<T extends AnyArray<ObjectT>> = T extends [
|
|
80
81
|
infer First,
|
|
81
82
|
...infer Rest extends AnyArray<ObjectT>
|
|
82
|
-
] ? [TransformT<First>, ...ReduceTuple2<Rest>] :
|
|
83
|
+
] ? [TransformT<First>, ...ReduceTuple2<Rest>] : [];
|
|
83
84
|
type ReduceTupleU<T extends AnyArray> = T extends [
|
|
84
85
|
infer First,
|
|
85
86
|
...infer Rest extends AnyArray
|
|
86
87
|
] ? [Undefiny<First>, ...ReduceTupleU<Rest>] : T[number] extends never ? [] : T["length"] extends 0 ? [] : number extends T["length"] ? T : Undefiny<T[number]>[];
|
|
87
|
-
type
|
|
88
|
+
type EmptyObject = {};
|
|
89
|
+
type __TransformUnion<T extends UnionCustom> = T extends UnionCustom<infer TCustom> ? Omit<T, typeof UNION> extends infer Ot ? Equals<Ot, EmptyObject> extends true ? TransformT<TCustom[number]> : TransformT<TCustom[number]> & TransformT<Ot> : never : never;
|
|
90
|
+
type __TransformPrimitiveObject<T> = Equals<ObjectMapS, T> extends true ? object : T extends Types ? TransformTypes<T> : T extends ArrayCustom<infer A> ? TransformT<A>[] : T extends UnionCustom ? __TransformUnion<T> : T extends SoRaCustom<infer TSoA> ? SoRa<__TransformPrimitiveObject<TSoA>> : T extends SoaCustom<infer TSoA> ? SoA<__TransformPrimitiveObject<TSoA>> : T extends Custom<infer TCustom> ? TCustom : T extends AnyArray<ObjectT> ? ReduceTuple2<T> : T extends PartialCustom<infer TPartial> ? Partial<__TransformPrimitiveObject<TPartial>> : T extends Optional<infer TOptional> ? __TransformPrimitiveObject<TOptional> | OptionalHelperClass : {
|
|
88
91
|
[K in keyof T]: __TransformPrimitiveObject<T[K]>;
|
|
89
92
|
};
|
|
90
93
|
type HasUndefined<T> = unknown extends T ? false : OptionalHelperClass extends T ? true : false;
|
|
@@ -97,14 +100,16 @@ type UndefinyObject<T extends object> = {
|
|
|
97
100
|
} : never;
|
|
98
101
|
type Undefiny<T, U = Exclude<T, OptionalHelperClass>> = U extends AnyArray ? ReduceTupleU<U> : U extends Ru ? UndefinyObject<U> : U;
|
|
99
102
|
type TransformT<T> = Undefiny<__TransformPrimitiveObject<T>>;
|
|
100
|
-
export type StandardHelper<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
export type StandardHelper<T1 = any, T2 = any> = {
|
|
104
|
+
__type: T1;
|
|
105
|
+
type: T2;
|
|
106
|
+
} & StandardSchemaV1<T2, T2>;
|
|
107
|
+
type _Sh<T1 = any, T2 = any> = StandardHelper<T1, T2>;
|
|
108
|
+
export type Sh<T extends ObjectT = ObjectT> = StandardHelper<T, inferO<T>>;
|
|
104
109
|
export type StandardOutput<T = any> = StandardSchemaV1<any, T>;
|
|
105
110
|
export type inferO<T extends ObjectT = ObjectT> = ObjectT extends T ? unknown : TransformT<T>;
|
|
106
|
-
export type inferSh<T extends ObjectT = ObjectT> =
|
|
111
|
+
export type inferSh<T extends ObjectT = ObjectT> = _Sh<T, inferO<T>>;
|
|
107
112
|
export type inferT<T extends StandardOutput = StandardOutput> = Exclude<T[StandardKey]["types"], undefined>["output"];
|
|
108
113
|
export type ProduceObject<T extends ObjectT = ObjectT> = T;
|
|
109
114
|
export type FnBasic<Main extends Fn, Tr extends object> = Tr & Main;
|
|
110
|
-
export
|
|
115
|
+
export * from "./standard.types";
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils__const = require("./_const.cjs");
|
|
2
3
|
const require_utils_expandFn = require("./expandFn.cjs");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#endregion
|
|
6
|
-
exports._const = _const;
|
|
4
|
+
const require_utils_isSh = require("./isSh.cjs");
|
|
5
|
+
exports._const = require_utils__const._const;
|
|
7
6
|
exports.expandFn = require_utils_expandFn.expandFn;
|
|
8
7
|
exports.expandFn2 = require_utils_expandFn.expandFn2;
|
|
8
|
+
exports.isSh = require_utils_isSh.isSh;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export * from
|
|
3
|
-
export
|
|
1
|
+
export * from "./_const";
|
|
2
|
+
export * from "./expandFn";
|
|
3
|
+
export * from "./isSh";
|
package/lib/utils/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
+
import { _const } from "./_const.js";
|
|
1
2
|
import { expandFn, expandFn2 } from "./expandFn.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#endregion
|
|
5
|
-
export { _const, expandFn, expandFn2 };
|
|
3
|
+
import { isSh } from "./isSh.js";
|
|
4
|
+
export { _const, expandFn, expandFn2, isSh };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../constants.cjs");
|
|
3
|
+
//#region src/utils/isSh.ts
|
|
4
|
+
const isSh = (value) => {
|
|
5
|
+
if (typeof value !== "object") return false;
|
|
6
|
+
if (value === null) return false;
|
|
7
|
+
return "__type" in value && "type" in value && "~standard" in value && typeof value["~standard"] === "object" && value["~standard"] !== null && "version" in value["~standard"] && typeof value["~standard"].version === "number" && "vendor" in value["~standard"] && typeof value["~standard"].vendor === "string" && "types" in value["~standard"] && typeof value["~standard"].types === "object" && value["~standard"].types !== null && "input" in value["~standard"].types && "output" in value["~standard"].types && "validate" in value["~standard"] && typeof value["~standard"].validate === "function";
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.isSh = isSh;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "../constants.js";
|
|
2
|
+
//#region src/utils/isSh.ts
|
|
3
|
+
const isSh = (value) => {
|
|
4
|
+
if (typeof value !== "object") return false;
|
|
5
|
+
if (value === null) return false;
|
|
6
|
+
return "__type" in value && "type" in value && "~standard" in value && typeof value["~standard"] === "object" && value["~standard"] !== null && "version" in value["~standard"] && typeof value["~standard"].version === "number" && "vendor" in value["~standard"] && typeof value["~standard"].vendor === "string" && "types" in value["~standard"] && typeof value["~standard"].types === "object" && value["~standard"].types !== null && "input" in value["~standard"].types && "output" in value["~standard"].types && "validate" in value["~standard"] && typeof value["~standard"].validate === "function";
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { isSh };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/typings",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Typings by variables",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "bri_lvi@icloud.com",
|
|
@@ -28,7 +28,13 @@
|
|
|
28
28
|
"types": "./lib/helpers/index.d.ts"
|
|
29
29
|
},
|
|
30
30
|
"./package.json": "./package.json",
|
|
31
|
-
"./tsconfig.json": "./tsconfig.json"
|
|
31
|
+
"./tsconfig.json": "./tsconfig.json",
|
|
32
|
+
"./types": {
|
|
33
|
+
"types": "./lib/types.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./standard": {
|
|
36
|
+
"types": "./lib/standard.types.d.ts"
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
39
|
"maintainers": [
|
|
34
40
|
{
|
|
@@ -100,28 +106,27 @@
|
|
|
100
106
|
}
|
|
101
107
|
],
|
|
102
108
|
"devDependencies": {
|
|
103
|
-
"@bemedev/dev-utils": "^0.
|
|
109
|
+
"@bemedev/dev-utils": "^0.7.0",
|
|
104
110
|
"@bemedev/fsf": "^1.0.1",
|
|
105
111
|
"@size-limit/file": "^12.1.0",
|
|
106
|
-
"@types/node": "^25.
|
|
107
|
-
"@vitest/coverage-v8": "^4.1.
|
|
108
|
-
"@vitest/ui": "4.1.
|
|
112
|
+
"@types/node": "^25.9.1",
|
|
113
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
114
|
+
"@vitest/ui": "4.1.7",
|
|
109
115
|
"glob": "^13.0.6",
|
|
110
116
|
"globals": "^17.6.0",
|
|
111
117
|
"husky": "^9.1.7",
|
|
112
118
|
"onchange": "^7.1.0",
|
|
113
|
-
"oxfmt": "^0.
|
|
114
|
-
"oxlint": "^1.
|
|
119
|
+
"oxfmt": "^0.51.0",
|
|
120
|
+
"oxlint": "^1.66.0",
|
|
115
121
|
"pretty-quick": "^4.2.2",
|
|
116
|
-
"rolldown": "1.0.
|
|
122
|
+
"rolldown": "1.0.2",
|
|
117
123
|
"size-limit": "^12.1.0",
|
|
118
124
|
"tslib": "^2.8.1",
|
|
119
125
|
"typescript": "^6.0.3",
|
|
120
|
-
"vitest": "^4.1.
|
|
126
|
+
"vitest": "^4.1.7"
|
|
127
|
+
},
|
|
128
|
+
"dependencies": {
|
|
129
|
+
"@standard-schema/spec": "^1.1.0"
|
|
121
130
|
},
|
|
122
|
-
"
|
|
123
|
-
"onlyBuiltDependencies": [
|
|
124
|
-
"esbuild"
|
|
125
|
-
]
|
|
126
|
-
}
|
|
131
|
+
"packageManager": "pnpm@11.2.2+sha512.36e6621fad506178936455e70247b8808ef4ec25797a9f437a93281a020484e2607f6a469a22e982987c3dbb8866e3071514ab10a4a1749e06edcd1ec118436f"
|
|
127
132
|
}
|