umt 3.0.0 → 3.2.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.
Files changed (133) hide show
  1. package/module/Date/getDay.d.ts +1 -2
  2. package/module/Object/keyBy.d.ts +3 -4
  3. package/module/Validate/any/core.d.ts +2 -1
  4. package/module/Validate/any/core.js +3 -2
  5. package/module/Validate/any/core.js.map +1 -1
  6. package/module/Validate/array/arrayOf.d.ts +3 -3
  7. package/module/Validate/array/arrayOf.js +3 -1
  8. package/module/Validate/array/arrayOf.js.map +1 -1
  9. package/module/Validate/bigint/core.d.ts +2 -1
  10. package/module/Validate/bigint/core.js +3 -1
  11. package/module/Validate/bigint/core.js.map +1 -1
  12. package/module/Validate/boolean/core.d.ts +2 -1
  13. package/module/Validate/boolean/core.js +3 -1
  14. package/module/Validate/boolean/core.js.map +1 -1
  15. package/module/Validate/date/core.d.ts +2 -1
  16. package/module/Validate/date/core.js +3 -1
  17. package/module/Validate/date/core.js.map +1 -1
  18. package/module/Validate/file/core.d.ts +2 -1
  19. package/module/Validate/file/core.js +3 -1
  20. package/module/Validate/file/core.js.map +1 -1
  21. package/module/Validate/function/core.d.ts +11 -11
  22. package/module/Validate/function/core.js +2 -1
  23. package/module/Validate/function/core.js.map +1 -1
  24. package/module/Validate/index.d.ts +1 -0
  25. package/module/Validate/index.js +1 -0
  26. package/module/Validate/index.js.map +1 -1
  27. package/module/Validate/instanceof/core.d.ts +3 -3
  28. package/module/Validate/instanceof/core.js +3 -1
  29. package/module/Validate/instanceof/core.js.map +1 -1
  30. package/module/Validate/map/core.d.ts +3 -3
  31. package/module/Validate/map/core.js +3 -1
  32. package/module/Validate/map/core.js.map +1 -1
  33. package/module/Validate/never/core.d.ts +2 -1
  34. package/module/Validate/never/core.js +7 -8
  35. package/module/Validate/never/core.js.map +1 -1
  36. package/module/Validate/number/core.d.ts +3 -2
  37. package/module/Validate/number/core.js +3 -1
  38. package/module/Validate/number/core.js.map +1 -1
  39. package/module/Validate/object/core.d.ts +2 -1
  40. package/module/Validate/object/core.js +2 -1
  41. package/module/Validate/object/core.js.map +1 -1
  42. package/module/Validate/object/intersection.d.ts +5 -5
  43. package/module/Validate/object/intersection.js +3 -1
  44. package/module/Validate/object/intersection.js.map +1 -1
  45. package/module/Validate/object/nullable.d.ts +3 -3
  46. package/module/Validate/object/nullable.js +2 -1
  47. package/module/Validate/object/nullable.js.map +1 -1
  48. package/module/Validate/object/optional.d.ts +3 -3
  49. package/module/Validate/object/optional.js +2 -1
  50. package/module/Validate/object/optional.js.map +1 -1
  51. package/module/Validate/object/partial.d.ts +1 -2
  52. package/module/Validate/object/required.d.ts +2 -3
  53. package/module/Validate/object/union.d.ts +3 -3
  54. package/module/Validate/object/union.js +3 -1
  55. package/module/Validate/object/union.js.map +1 -1
  56. package/module/Validate/set/core.d.ts +3 -3
  57. package/module/Validate/set/core.js +3 -1
  58. package/module/Validate/set/core.js.map +1 -1
  59. package/module/Validate/standardSchema.d.ts +93 -0
  60. package/module/Validate/standardSchema.js +58 -0
  61. package/module/Validate/standardSchema.js.map +1 -0
  62. package/module/Validate/string/core.d.ts +3 -2
  63. package/module/Validate/string/core.js +5 -1
  64. package/module/Validate/string/core.js.map +1 -1
  65. package/module/Validate/templateLiteral/core.d.ts +7 -7
  66. package/module/Validate/templateLiteral/core.js +3 -1
  67. package/module/Validate/templateLiteral/core.js.map +1 -1
  68. package/module/Validate/unknown/core.d.ts +2 -1
  69. package/module/Validate/unknown/core.js +3 -1
  70. package/module/Validate/unknown/core.js.map +1 -1
  71. package/module/es5/Date/getDay.d.ts +1 -2
  72. package/module/es5/Object/keyBy.d.ts +3 -4
  73. package/module/es5/Validate/any/core.d.ts +2 -1
  74. package/module/es5/Validate/any/core.js +3 -2
  75. package/module/es5/Validate/array/arrayOf.d.ts +3 -3
  76. package/module/es5/Validate/array/arrayOf.js +3 -1
  77. package/module/es5/Validate/bigint/core.d.ts +2 -1
  78. package/module/es5/Validate/bigint/core.js +4 -4
  79. package/module/es5/Validate/boolean/core.d.ts +2 -1
  80. package/module/es5/Validate/boolean/core.js +3 -1
  81. package/module/es5/Validate/date/core.d.ts +2 -1
  82. package/module/es5/Validate/date/core.js +3 -1
  83. package/module/es5/Validate/file/core.d.ts +2 -1
  84. package/module/es5/Validate/file/core.js +3 -1
  85. package/module/es5/Validate/function/core.d.ts +11 -11
  86. package/module/es5/Validate/function/core.js +3 -6
  87. package/module/es5/Validate/index.d.ts +1 -0
  88. package/module/es5/Validate/index.js +11 -0
  89. package/module/es5/Validate/instanceof/core.d.ts +3 -3
  90. package/module/es5/Validate/instanceof/core.js +3 -1
  91. package/module/es5/Validate/map/core.d.ts +3 -3
  92. package/module/es5/Validate/map/core.js +4 -4
  93. package/module/es5/Validate/never/core.d.ts +2 -1
  94. package/module/es5/Validate/never/core.js +3 -2
  95. package/module/es5/Validate/number/core.d.ts +3 -2
  96. package/module/es5/Validate/number/core.js +3 -1
  97. package/module/es5/Validate/object/core.d.ts +2 -1
  98. package/module/es5/Validate/object/core.js +2 -1
  99. package/module/es5/Validate/object/intersection.d.ts +5 -5
  100. package/module/es5/Validate/object/intersection.js +3 -1
  101. package/module/es5/Validate/object/nullable.d.ts +3 -3
  102. package/module/es5/Validate/object/nullable.js +2 -1
  103. package/module/es5/Validate/object/optional.d.ts +3 -3
  104. package/module/es5/Validate/object/optional.js +2 -1
  105. package/module/es5/Validate/object/partial.d.ts +1 -2
  106. package/module/es5/Validate/object/required.d.ts +2 -3
  107. package/module/es5/Validate/object/union.d.ts +3 -3
  108. package/module/es5/Validate/object/union.js +3 -1
  109. package/module/es5/Validate/set/core.d.ts +3 -3
  110. package/module/es5/Validate/set/core.js +4 -4
  111. package/module/es5/Validate/standardSchema.d.ts +93 -0
  112. package/module/es5/Validate/standardSchema.js +91 -0
  113. package/module/es5/Validate/string/core.d.ts +3 -2
  114. package/module/es5/Validate/string/core.js +3 -1
  115. package/module/es5/Validate/templateLiteral/core.d.ts +7 -7
  116. package/module/es5/Validate/templateLiteral/core.js +7 -6
  117. package/module/es5/Validate/unknown/core.d.ts +2 -1
  118. package/module/es5/Validate/unknown/core.js +3 -1
  119. package/module/es5/types/array/chunk.d.ts +1 -2
  120. package/module/es5/types/array/zip.d.ts +4 -2
  121. package/module/es5/types/logic/binary1bitNor.d.ts +1 -2
  122. package/module/es5/types/logic/binaryFullAdder.d.ts +1 -2
  123. package/module/es5/types/math/divide.d.ts +1 -2
  124. package/module/es5/types/math/multiply.d.ts +1 -2
  125. package/module/es5/types/object/pickDeep.d.ts +3 -4
  126. package/module/types/array/chunk.d.ts +1 -2
  127. package/module/types/array/zip.d.ts +4 -2
  128. package/module/types/logic/binary1bitNor.d.ts +1 -2
  129. package/module/types/logic/binaryFullAdder.d.ts +1 -2
  130. package/module/types/math/divide.d.ts +1 -2
  131. package/module/types/math/multiply.d.ts +1 -2
  132. package/module/types/object/pickDeep.d.ts +3 -4
  133. package/package.json +9 -9
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.optional = void 0;
7
+ var _standardSchema = require("../../Validate/standardSchema");
7
8
  /**
8
9
  * Optional validator augmented with a reference to the wrapped validator,
9
10
  * used by `required()` to unwrap optional layers when rebuilding a shape
@@ -31,5 +32,5 @@ var optional = exports.optional = function optional(validator) {
31
32
  };
32
33
  optionalValidator.inner = validator;
33
34
  optionalValidator.isOptional = true;
34
- return optionalValidator;
35
+ return (0, _standardSchema.attachStandard)(optionalValidator);
35
36
  };
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { type ObjectShape, type ObjectValidator } from "./core";
8
8
  import { type OptionalValidator } from "./optional";
9
- type PartialShape<T extends ObjectShape> = {
9
+ export type PartialShape<T extends ObjectShape> = {
10
10
  [K in keyof T]: OptionalValidator<Parameters<T[K]>[0], ReturnType<T[K]> extends {
11
11
  type: unknown;
12
12
  message: string;
@@ -22,4 +22,3 @@ type PartialShape<T extends ObjectShape> = {
22
22
  * @returns {ObjectValidator<PartialShape<T>>} - New validator where every key accepts undefined
23
23
  */
24
24
  export declare const partial: <T extends ObjectShape>(validator: ObjectValidator<T>, message?: string) => ObjectValidator<PartialShape<T>>;
25
- export {};
@@ -6,8 +6,8 @@
6
6
  */
7
7
  import { type ObjectShape, type ObjectValidator } from "./core";
8
8
  import type { OptionalValidator } from "./optional";
9
- type UnwrapOptional<V> = V extends OptionalValidator<infer Inner, infer R> ? (value: Inner) => R : V;
10
- type RequiredShape<T extends ObjectShape> = {
9
+ export type UnwrapOptional<V> = V extends OptionalValidator<infer Inner, infer R> ? (value: Inner) => R : V;
10
+ export type RequiredShape<T extends ObjectShape> = {
11
11
  [K in keyof T]: UnwrapOptional<T[K]> extends ObjectShape[string] ? UnwrapOptional<T[K]> : T[K];
12
12
  };
13
13
  /**
@@ -19,4 +19,3 @@ type RequiredShape<T extends ObjectShape> = {
19
19
  * @returns {ObjectValidator<RequiredShape<T>>} - New validator where every optional layer is removed
20
20
  */
21
21
  export declare const required: <T extends ObjectShape>(validator: ObjectValidator<T>, message?: string) => ObjectValidator<RequiredShape<T>>;
22
- export {};
@@ -1,5 +1,6 @@
1
+ import { type StandardSchemaV1 } from "../../Validate/standardSchema";
1
2
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
2
- type ExtractValidatedType<V> = V extends (value: never) => {
3
+ export type UnionExtractValidatedType<V> = V extends (value: never) => {
3
4
  type: infer T;
4
5
  } ? ValidateType<T> : never;
5
6
  /**
@@ -7,5 +8,4 @@ type ExtractValidatedType<V> = V extends (value: never) => {
7
8
  * @param validators - Validator functions to compose as a union (logical OR)
8
9
  * @returns {Function} - Validator that checks if the value matches any of the validators
9
10
  */
10
- export declare const union: <Vs extends ((value: never) => ValidateCoreReturnType<unknown>)[]>(...validators: [...Vs]) => (value: ExtractValidatedType<Vs[number]>) => ValidateCoreReturnType<ExtractValidatedType<Vs[number]>>;
11
- export {};
11
+ export declare const union: <Vs extends ((value: never) => ValidateCoreReturnType<unknown>)[]>(...validators: [...Vs]) => ((value: UnionExtractValidatedType<Vs[number]>) => ValidateCoreReturnType<UnionExtractValidatedType<Vs[number]>>) & StandardSchemaV1<UnionExtractValidatedType<Vs[number]>, UnionExtractValidatedType<Vs[number]>>;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.union = void 0;
7
+ var _standardSchema = require("../../Validate/standardSchema");
7
8
  // Extract the validated value type by reading the validator's `type` field
8
9
  // (and applying `ValidateType` to map type tags like "string" back to the
9
10
  // runtime type). Reading the field directly lets validators that expose the
@@ -19,7 +20,7 @@ var union = exports.union = function union() {
19
20
  for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
20
21
  validators[_key] = arguments[_key];
21
22
  }
22
- return function (value) {
23
+ var unionValidator = function unionValidator(value) {
23
24
  var lastMessage = "";
24
25
  for (var _i = 0, _validators = validators; _i < _validators.length; _i++) {
25
26
  var validator = _validators[_i];
@@ -39,4 +40,5 @@ var union = exports.union = function union() {
39
40
  type: value
40
41
  };
41
42
  };
43
+ return (0, _standardSchema.attachStandard)(unionValidator);
42
44
  };
@@ -7,8 +7,9 @@
7
7
  * The function is exported as `set_` because the top-level `Object` module
8
8
  * already exposes a `set` runtime helper.
9
9
  */
10
+ import { type StandardSchemaV1 } from "../../Validate/standardSchema";
10
11
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
11
- type ExtractValidatedType<V> = V extends (value: never) => {
12
+ export type SetExtractValidatedType<V> = V extends (value: never) => {
12
13
  type: infer T;
13
14
  } ? ValidateType<T> : never;
14
15
  /**
@@ -20,5 +21,4 @@ type ExtractValidatedType<V> = V extends (value: never) => {
20
21
  * @param {string} [message] - Custom error message for type validation
21
22
  * @returns {Function} - Validator function for Set instances
22
23
  */
23
- export declare const set_: <IV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, T = ExtractValidatedType<IV>>(itemValidator?: IV, message?: string) => (value: Set<T>) => ValidateCoreReturnType<Set<T>>;
24
- export {};
24
+ export declare const set_: <IV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, T = SetExtractValidatedType<IV>>(itemValidator?: IV, message?: string) => ((value: Set<T>) => ValidateCoreReturnType<Set<T>>) & StandardSchemaV1<Set<T>, Set<T>>;
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.set_ = void 0;
7
+ var _standardSchema = require("../../Validate/standardSchema");
7
8
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
9
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
- /**
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /**
11
11
  * Set validation core module
12
12
  * Provides validation for `Set` instances. The validator can optionally
13
13
  * delegate to a per-element validator, mirroring how `arrayOf()` validates
@@ -16,7 +16,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
16
16
  * The function is exported as `set_` because the top-level `Object` module
17
17
  * already exposes a `set` runtime helper.
18
18
  */
19
-
20
19
  /**
21
20
  * Creates a Set validator. When a per-element validator is supplied, every
22
21
  * element of the set must satisfy it; iteration short-circuits at the first
@@ -27,7 +26,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
27
26
  * @returns {Function} - Validator function for Set instances
28
27
  */
29
28
  var set_ = exports.set_ = function set_(itemValidator, message) {
30
- return function (value) {
29
+ var setValidator = function setValidator(value) {
31
30
  if (!(value instanceof Set)) {
32
31
  return {
33
32
  validate: false,
@@ -62,4 +61,5 @@ var set_ = exports.set_ = function set_(itemValidator, message) {
62
61
  type: value
63
62
  };
64
63
  };
64
+ return (0, _standardSchema.attachStandard)(setValidator);
65
65
  };
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Standard Schema V1 integration
3
+ *
4
+ * Defines the public Standard Schema V1 surface (https://standardschema.dev)
5
+ * and exposes the `attachStandard()` helper used by every UMT validator
6
+ * factory to advertise itself as a Standard Schema V1 implementation. The
7
+ * `~standard` property added by `attachStandard()` lets external tools
8
+ * (Zod-, Valibot-, ArkType-style ecosystems) consume UMT validators without
9
+ * adapters.
10
+ *
11
+ * Biome's `noNamespace` lint rule forbids TypeScript namespaces, so the spec
12
+ * is mirrored with flat interface/type names that remain structurally
13
+ * compatible with the official `StandardSchemaV1` interface published by
14
+ * `@standard-schema/spec`.
15
+ */
16
+ /** The Standard Schema V1 interface. */
17
+ export interface StandardSchemaV1<Input = unknown, Output = Input> {
18
+ readonly "~standard": StandardSchemaV1Properties<Input, Output>;
19
+ }
20
+ /** The Standard Schema V1 properties interface. */
21
+ export interface StandardSchemaV1Properties<Input = unknown, Output = Input> {
22
+ /** The version number of the standard. */
23
+ readonly version: 1;
24
+ /** The vendor name of the schema library. */
25
+ readonly vendor: string;
26
+ /** Validates unknown input values. */
27
+ readonly validate: (value: unknown) => StandardSchemaV1Result<Output> | Promise<StandardSchemaV1Result<Output>>;
28
+ /** Inferred types associated with the schema. */
29
+ readonly types?: StandardSchemaV1Types<Input, Output> | undefined;
30
+ }
31
+ /** The result type produced by `Props.validate`. */
32
+ export type StandardSchemaV1Result<Output> = StandardSchemaV1SuccessResult<Output> | StandardSchemaV1FailureResult;
33
+ /** The result interface when validation succeeds. */
34
+ export interface StandardSchemaV1SuccessResult<Output> {
35
+ readonly value: Output;
36
+ readonly issues?: undefined;
37
+ }
38
+ /** The result interface when validation fails. */
39
+ export interface StandardSchemaV1FailureResult {
40
+ readonly issues: readonly StandardSchemaV1Issue[];
41
+ }
42
+ /** The issue interface returned on failure. */
43
+ export interface StandardSchemaV1Issue {
44
+ readonly message: string;
45
+ readonly path?: readonly (PropertyKey | StandardSchemaV1PathSegment)[] | undefined;
46
+ }
47
+ /** The path segment interface for nested issues. */
48
+ export interface StandardSchemaV1PathSegment {
49
+ readonly key: PropertyKey;
50
+ }
51
+ /** The Standard Schema V1 types interface. */
52
+ export interface StandardSchemaV1Types<Input = unknown, Output = Input> {
53
+ /** The input type of the schema. */
54
+ readonly input: Input;
55
+ /** The output type of the schema. */
56
+ readonly output: Output;
57
+ }
58
+ /** Infers the input type of a Standard Schema V1 implementation. */
59
+ export type StandardSchemaV1InferInput<Schema extends StandardSchemaV1<any, any>> = NonNullable<Schema["~standard"]["types"]>["input"];
60
+ /** Infers the output type of a Standard Schema V1 implementation. */
61
+ export type StandardSchemaV1InferOutput<Schema extends StandardSchemaV1<any, any>> = NonNullable<Schema["~standard"]["types"]>["output"];
62
+ /**
63
+ * Vendor identifier used by all UMT validators when advertising Standard
64
+ * Schema V1 compatibility. External tools may key off this value to attach
65
+ * UMT-specific behavior.
66
+ */
67
+ export declare const STANDARD_SCHEMA_VENDOR = "umt";
68
+ /** Minimal shape of UMT validator results consumed by `attachStandard`. */
69
+ export interface UmtValidatorResult {
70
+ validate: boolean;
71
+ message: string;
72
+ type: unknown;
73
+ }
74
+ /**
75
+ * Attaches a Standard Schema V1 `~standard` property to a UMT validator
76
+ * function in place. The validator's existing call signature, attached
77
+ * helpers (such as `shape` on `object()` or `implement` on `function_()`),
78
+ * and return type are preserved untouched; only the `~standard` property is
79
+ * added.
80
+ *
81
+ * Validation is delegated to the wrapped validator. On success the input
82
+ * value is returned through the Standard Schema `value` field; on failure a
83
+ * single issue carrying the validator's message is emitted. UMT validators
84
+ * never transform their input, so `Input` and `Output` default to the same
85
+ * type.
86
+ *
87
+ * @template Input - The input type advertised through `~standard.types`
88
+ * @template Output - The output type advertised through `~standard.types`
89
+ * @template F - The validator function being augmented
90
+ * @param {F} validator - The validator function to augment
91
+ * @returns {F & StandardSchemaV1<Input, Output>} The same function with `~standard` attached
92
+ */
93
+ export declare const attachStandard: <Input, Output = Input, F extends (...arguments_: any[]) => UmtValidatorResult = (...arguments_: any[]) => UmtValidatorResult>(validator: F) => F & StandardSchemaV1<Input, Output>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attachStandard = exports.STANDARD_SCHEMA_VENDOR = void 0;
7
+ /**
8
+ * Standard Schema V1 integration
9
+ *
10
+ * Defines the public Standard Schema V1 surface (https://standardschema.dev)
11
+ * and exposes the `attachStandard()` helper used by every UMT validator
12
+ * factory to advertise itself as a Standard Schema V1 implementation. The
13
+ * `~standard` property added by `attachStandard()` lets external tools
14
+ * (Zod-, Valibot-, ArkType-style ecosystems) consume UMT validators without
15
+ * adapters.
16
+ *
17
+ * Biome's `noNamespace` lint rule forbids TypeScript namespaces, so the spec
18
+ * is mirrored with flat interface/type names that remain structurally
19
+ * compatible with the official `StandardSchemaV1` interface published by
20
+ * `@standard-schema/spec`.
21
+ */
22
+
23
+ /** The Standard Schema V1 interface. */
24
+
25
+ /** The Standard Schema V1 properties interface. */
26
+
27
+ /** The result type produced by `Props.validate`. */
28
+
29
+ /** The result interface when validation succeeds. */
30
+
31
+ /** The result interface when validation fails. */
32
+
33
+ /** The issue interface returned on failure. */
34
+
35
+ /** The path segment interface for nested issues. */
36
+
37
+ /** The Standard Schema V1 types interface. */
38
+
39
+ /** Infers the input type of a Standard Schema V1 implementation. */
40
+
41
+ /** Infers the output type of a Standard Schema V1 implementation. */
42
+
43
+ /**
44
+ * Vendor identifier used by all UMT validators when advertising Standard
45
+ * Schema V1 compatibility. External tools may key off this value to attach
46
+ * UMT-specific behavior.
47
+ */
48
+ var STANDARD_SCHEMA_VENDOR = exports.STANDARD_SCHEMA_VENDOR = "umt";
49
+
50
+ /** Minimal shape of UMT validator results consumed by `attachStandard`. */
51
+
52
+ /**
53
+ * Attaches a Standard Schema V1 `~standard` property to a UMT validator
54
+ * function in place. The validator's existing call signature, attached
55
+ * helpers (such as `shape` on `object()` or `implement` on `function_()`),
56
+ * and return type are preserved untouched; only the `~standard` property is
57
+ * added.
58
+ *
59
+ * Validation is delegated to the wrapped validator. On success the input
60
+ * value is returned through the Standard Schema `value` field; on failure a
61
+ * single issue carrying the validator's message is emitted. UMT validators
62
+ * never transform their input, so `Input` and `Output` default to the same
63
+ * type.
64
+ *
65
+ * @template Input - The input type advertised through `~standard.types`
66
+ * @template Output - The output type advertised through `~standard.types`
67
+ * @template F - The validator function being augmented
68
+ * @param {F} validator - The validator function to augment
69
+ * @returns {F & StandardSchemaV1<Input, Output>} The same function with `~standard` attached
70
+ */
71
+ var attachStandard = exports.attachStandard = function attachStandard(validator) {
72
+ var properties = {
73
+ version: 1,
74
+ vendor: STANDARD_SCHEMA_VENDOR,
75
+ validate: function validate(value) {
76
+ var result = validator(value);
77
+ if (result.validate) {
78
+ return {
79
+ value: value
80
+ };
81
+ }
82
+ return {
83
+ issues: [{
84
+ message: result.message || "Validation failed"
85
+ }]
86
+ };
87
+ }
88
+ };
89
+ validator["~standard"] = properties;
90
+ return validator;
91
+ };
@@ -2,7 +2,8 @@
2
2
  * String validation core module
3
3
  * Provides the base validation functionality for string values
4
4
  */
5
- import type { ValidateReturnType } from "../../Validate/type";
5
+ import { type StandardSchemaV1 } from "../../Validate/standardSchema";
6
+ import type { ValidateCoreReturnType, ValidateReturnType } from "../../Validate/type";
6
7
  /**
7
8
  * Creates a string validator with optional validation rules
8
9
  * @template T - Array of validation rules for strings
@@ -10,4 +11,4 @@ import type { ValidateReturnType } from "../../Validate/type";
10
11
  * @param {string} [message] - Custom error message for type validation
11
12
  * @returns {Function} - Validator function that checks if the value is a string and applies validation rules
12
13
  */
13
- export declare const string: <T extends ValidateReturnType<string>[]>(option?: T, message?: string) => (value: string) => import("../../Validate/type").ValidateCoreReturnType<string>;
14
+ export declare const string: <T extends ValidateReturnType<string>[]>(option?: T, message?: string) => ((value: string) => ValidateCoreReturnType<string>) & StandardSchemaV1<string, string>;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.string = void 0;
7
7
  var _core = require("../../Validate/core");
8
+ var _standardSchema = require("../../Validate/standardSchema");
8
9
  /**
9
10
  * String validation core module
10
11
  * Provides the base validation functionality for string values
@@ -18,7 +19,8 @@ var _core = require("../../Validate/core");
18
19
  * @returns {Function} - Validator function that checks if the value is a string and applies validation rules
19
20
  */
20
21
  var string = exports.string = function string(option, message) {
21
- return function (value) {
22
+ var validator = function validator(value) {
22
23
  return (0, _core.core)("string")(value, option, message);
23
24
  };
25
+ return (0, _standardSchema.attachStandard)(validator);
24
26
  };
@@ -6,8 +6,9 @@
6
6
  * an auto-generated regular expression assembled from the parts, while the
7
7
  * inferred type is the corresponding TypeScript template literal type.
8
8
  */
9
+ import { type StandardSchemaV1 } from "../../Validate/standardSchema";
9
10
  import type { ValidateType } from "../../Validate/type";
10
- type AnyValidator = (value?: any) => {
11
+ export type TemplateLiteralAnyValidator = (value?: any) => {
11
12
  type: unknown;
12
13
  };
13
14
  /**
@@ -15,12 +16,12 @@ type AnyValidator = (value?: any) => {
15
16
  * string literal that must appear verbatim, or a primitive validator whose
16
17
  * accepted shape is converted to a regex fragment at construction time.
17
18
  */
18
- export type TemplateLiteralPart = string | AnyValidator;
19
- type ExtractValidatorTag<V> = V extends (value: never) => {
19
+ export type TemplateLiteralPart = string | TemplateLiteralAnyValidator;
20
+ export type ExtractValidatorTag<V> = V extends (value: never) => {
20
21
  type: infer T;
21
22
  } ? T : never;
22
- type TagToTemplate<T> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "bigint" ? bigint : ValidateType<T>;
23
- type PartToTemplate<P> = P extends string ? P : TagToTemplate<ExtractValidatorTag<P>>;
23
+ export type TagToTemplate<T> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "bigint" ? bigint : ValidateType<T>;
24
+ export type PartToTemplate<P> = P extends string ? P : TagToTemplate<ExtractValidatorTag<P>>;
24
25
  /**
25
26
  * Builds the template literal type produced by joining `Parts`. Each part is
26
27
  * mapped to either its literal string value or to the runtime type that the
@@ -51,5 +52,4 @@ export interface TemplateLiteralReturnType<T extends string> {
51
52
  * @param {string} [message] - Custom error message for validation failure
52
53
  * @returns {Function} - Validator function for template literal strings
53
54
  */
54
- export declare const templateLiteral: <const Parts extends readonly TemplateLiteralPart[]>(parts: Parts, message?: string) => (value: BuildTemplateLiteral<Parts>) => TemplateLiteralReturnType<BuildTemplateLiteral<Parts>>;
55
- export {};
55
+ export declare const templateLiteral: <const Parts extends readonly TemplateLiteralPart[]>(parts: Parts, message?: string) => ((value: BuildTemplateLiteral<Parts>) => TemplateLiteralReturnType<BuildTemplateLiteral<Parts>>) & StandardSchemaV1<BuildTemplateLiteral<Parts>, BuildTemplateLiteral<Parts>>;
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.templateLiteral = void 0;
7
+ var _standardSchema = require("../../Validate/standardSchema");
7
8
  var _templateObject, _templateObject2, _templateObject3;
8
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
9
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
12
9
  /**
13
10
  * Template literal validation core module
14
11
  * Provides a validator that checks whether a string matches a template
@@ -17,7 +14,10 @@ function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.fre
17
14
  * an auto-generated regular expression assembled from the parts, while the
18
15
  * inferred type is the corresponding TypeScript template literal type.
19
16
  */
20
-
17
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
18
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
19
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
20
+ function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
21
21
  // biome-ignore lint/suspicious/noExplicitAny: validator signatures vary
22
22
 
23
23
  /**
@@ -97,7 +97,7 @@ var templateLiteral = exports.templateLiteral = function templateLiteral(parts,
97
97
  }
98
98
  pattern += "$";
99
99
  var regex = new RegExp(pattern);
100
- return function (value) {
100
+ var templateValidator = function templateValidator(value) {
101
101
  if (typeof value !== "string" || !regex.test(value)) {
102
102
  return {
103
103
  validate: false,
@@ -111,4 +111,5 @@ var templateLiteral = exports.templateLiteral = function templateLiteral(parts,
111
111
  type: value
112
112
  };
113
113
  };
114
+ return (0, _standardSchema.attachStandard)(templateValidator);
114
115
  };
@@ -3,6 +3,7 @@
3
3
  * Provides a validator that accepts any value but exposes it as `unknown`
4
4
  * to keep callers honest about narrowing before use.
5
5
  */
6
+ import { type StandardSchemaV1 } from "../../Validate/standardSchema";
6
7
  /**
7
8
  * Return type produced by an `unknown` validator. Exposes the literal
8
9
  * `"unknown"` tag through the `type` field so `ValidateType<"unknown">` can
@@ -18,4 +19,4 @@ export interface UnknownReturnType {
18
19
  * Creates a validator that accepts any value but typed as unknown
19
20
  * @returns {Function} - Validator that always succeeds
20
21
  */
21
- export declare const unknown: () => ((value: unknown) => UnknownReturnType);
22
+ export declare const unknown: () => ((value: unknown) => UnknownReturnType) & StandardSchemaV1<unknown, unknown>;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.unknown = void 0;
7
+ var _standardSchema = require("../../Validate/standardSchema");
7
8
  /**
8
9
  * Unknown validation core module
9
10
  * Provides a validator that accepts any value but exposes it as `unknown`
@@ -24,11 +25,12 @@ var unknownValidator = function unknownValidator(_value) {
24
25
  type: "unknown"
25
26
  };
26
27
  };
28
+ var standardUnknownValidator = (0, _standardSchema.attachStandard)(unknownValidator);
27
29
 
28
30
  /**
29
31
  * Creates a validator that accepts any value but typed as unknown
30
32
  * @returns {Function} - Validator that always succeeds
31
33
  */
32
34
  var unknown = exports.unknown = function unknown() {
33
- return unknownValidator;
35
+ return standardUnknownValidator;
34
36
  };
@@ -1,4 +1,3 @@
1
1
  import type { Length } from "../logic/length";
2
- type Chunk<T, N extends number, C extends unknown[] = [], R extends unknown[] = []> = T extends [infer F, ...infer L] ? Length<C> extends N ? Chunk<L, N, [F], [...R, C]> : Chunk<L, N, [...C, F], R> : Length<C> extends 0 ? Length<R> extends 0 ? T[] : R : [...R, C];
2
+ export type Chunk<T, N extends number, C extends unknown[] = [], R extends unknown[] = []> = T extends [infer F, ...infer L] ? Length<C> extends N ? Chunk<L, N, [F], [...R, C]> : Chunk<L, N, [...C, F], R> : Length<C> extends 0 ? Length<R> extends 0 ? T[] : R : [...R, C];
3
3
  export type ChunkArrayType<T, N extends number> = Chunk<T, N>;
4
- export {};
@@ -1,3 +1,5 @@
1
- type ZIP<T, O extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? Head extends unknown[] ? ZIP<Tail, [...O, Head[number]]> : never : T extends [] ? O[] : T;
1
+ export type ZIP<T, O extends unknown[] = []> = T extends [
2
+ infer Head,
3
+ ...infer Tail
4
+ ] ? Head extends unknown[] ? ZIP<Tail, [...O, Head[number]]> : never : T extends [] ? O[] : T;
2
5
  export type ZipArrayType<T extends unknown[][]> = ZIP<T>;
3
- export {};
@@ -1,3 +1,2 @@
1
1
  export type Binary1bitNor<X extends `${0 | 1}`, Y extends `${0 | 1}`> = Binary1bitNorParser<X, Y>;
2
- type Binary1bitNorParser<X extends string, Y extends string> = X extends "1" ? "0" : Y extends "1" ? "0" : "1";
3
- export {};
2
+ export type Binary1bitNorParser<X extends string, Y extends string> = X extends "1" ? "0" : Y extends "1" ? "0" : "1";
@@ -5,5 +5,4 @@ import type { LengthOfString } from "./lengthOfString";
5
5
  import type { ShiftString } from "./shiftString";
6
6
  import type { StringReverse } from "./stringReverse";
7
7
  export type BinaryFullAdder<X extends string, Y extends string, B extends number = LengthOfString<X>> = LengthOfString<X> extends LengthOfString<Y> ? FirstNChars<ShiftString<StringReverse<BinaryFullAdderParser<StringReverse<FirstNChars<X, B>>, StringReverse<FirstNChars<Y, B>>>>>, B> : never;
8
- type BinaryFullAdderParser<X extends string, Y extends string, A extends string = "", C extends string = "0"> = X extends `${infer F}${infer R}` ? Y extends `${infer F2}${infer R2}` ? BinaryHalfAdderParser<F, F2> extends `${infer F3}${infer R3}` ? BinaryHalfAdderParser<R3, C> extends `${infer F4}${infer R4}` ? BinaryFullAdderParser<R, R2, `${A}${R4}`, Binary1bitOrParser<F3, F4>> : never : never : never : `${A}${C}`;
9
- export {};
8
+ export type BinaryFullAdderParser<X extends string, Y extends string, A extends string = "", C extends string = "0"> = X extends `${infer F}${infer R}` ? Y extends `${infer F2}${infer R2}` ? BinaryHalfAdderParser<F, F2> extends `${infer F3}${infer R3}` ? BinaryHalfAdderParser<R3, C> extends `${infer F4}${infer R4}` ? BinaryFullAdderParser<R, R2, `${A}${R4}`, Binary1bitOrParser<F3, F4>> : never : never : never : `${A}${C}`;
@@ -2,5 +2,4 @@ import type { Add } from "./add";
2
2
  import type { Subtract } from "./subtract";
3
3
  import type { BGreaterThanA } from "../logic/bGreaterThanA";
4
4
  export type Divide<A extends number, B extends number> = A extends 0 ? never : B extends 0 ? never : `${A}` extends `-${infer N extends number}` ? `${B}` extends `-${infer M extends number}` ? DivideHelper<N, M> : `-${DivideHelper<N, B>}` extends `${infer R extends number}` ? R : never : `${B}` extends `-${infer M extends number}` ? `-${DivideHelper<A, M>}` extends `${infer R extends number}` ? R : never : DivideHelper<A, B>;
5
- type DivideHelper<X extends number, Y extends number, A extends number = 0> = BGreaterThanA<X, Y> extends true ? A : DivideHelper<Subtract<X, Y>, Y, Add<A, 1>>;
6
- export {};
5
+ export type DivideHelper<X extends number, Y extends number, A extends number = 0> = BGreaterThanA<X, Y> extends true ? A : DivideHelper<Subtract<X, Y>, Y, Add<A, 1>>;
@@ -1,5 +1,4 @@
1
1
  import type { Add } from "./add";
2
2
  import type { Subtract } from "./subtract";
3
3
  export type Multiply<A extends number, B extends number> = MultiHelper<A, B>;
4
- type MultiHelper<X extends number, Y extends number, A extends number = 0> = `${X}` extends `-${infer N extends number}` ? `${Y}` extends `-${infer M extends number}` ? MultiHelper<N, M, A> : `-${MultiHelper<N, Y, A>}` extends `${infer R extends number}` ? R : never : `${Y}` extends `-${infer M extends number}` ? `-${MultiHelper<X, M, A>}` extends `${infer R extends number}` ? R : never : Y extends 0 ? A : MultiHelper<X, Subtract<Y, 1>, Add<X, A>>;
5
- export {};
4
+ export type MultiHelper<X extends number, Y extends number, A extends number = 0> = `${X}` extends `-${infer N extends number}` ? `${Y}` extends `-${infer M extends number}` ? MultiHelper<N, M, A> : `-${MultiHelper<N, Y, A>}` extends `${infer R extends number}` ? R : never : `${Y}` extends `-${infer M extends number}` ? `-${MultiHelper<X, M, A>}` extends `${infer R extends number}` ? R : never : Y extends 0 ? A : MultiHelper<X, Subtract<Y, 1>, Add<X, A>>;
@@ -1,13 +1,12 @@
1
1
  import type { PickDeepKey } from "./pickDeepKey";
2
2
  import type { UnionToIntersection } from "../logic/unionToIntersection";
3
- type GetValueAtPath<T, P extends string> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? T[Key] extends object ? GetValueAtPath<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
4
- type ConstructNestedObject<P extends string, V> = P extends `${infer Key}.${infer Rest}` ? {
3
+ export type GetValueAtPath<T, P extends string> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? T[Key] extends object ? GetValueAtPath<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
4
+ export type ConstructNestedObject<P extends string, V> = P extends `${infer Key}.${infer Rest}` ? {
5
5
  [K in Key]: ConstructNestedObject<Rest, V>;
6
6
  } : {
7
7
  [K in P]: V;
8
8
  };
9
- type ProcessKeys<T extends object, K extends readonly PickDeepKey<T>[]> = {
9
+ export type ProcessKeys<T extends object, K extends readonly PickDeepKey<T>[]> = {
10
10
  [I in keyof K]: K[I] extends string ? ConstructNestedObject<K[I], GetValueAtPath<T, K[I]>> : never;
11
11
  }[number];
12
12
  export type PickDeep<T extends object, K extends readonly PickDeepKey<T>[]> = UnionToIntersection<ProcessKeys<T, K>>;
13
- export {};
@@ -1,4 +1,3 @@
1
1
  import type { Length } from "../logic/length";
2
- type Chunk<T, N extends number, C extends unknown[] = [], R extends unknown[] = []> = T extends [infer F, ...infer L] ? Length<C> extends N ? Chunk<L, N, [F], [...R, C]> : Chunk<L, N, [...C, F], R> : Length<C> extends 0 ? Length<R> extends 0 ? T[] : R : [...R, C];
2
+ export type Chunk<T, N extends number, C extends unknown[] = [], R extends unknown[] = []> = T extends [infer F, ...infer L] ? Length<C> extends N ? Chunk<L, N, [F], [...R, C]> : Chunk<L, N, [...C, F], R> : Length<C> extends 0 ? Length<R> extends 0 ? T[] : R : [...R, C];
3
3
  export type ChunkArrayType<T, N extends number> = Chunk<T, N>;
4
- export {};
@@ -1,3 +1,5 @@
1
- type ZIP<T, O extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? Head extends unknown[] ? ZIP<Tail, [...O, Head[number]]> : never : T extends [] ? O[] : T;
1
+ export type ZIP<T, O extends unknown[] = []> = T extends [
2
+ infer Head,
3
+ ...infer Tail
4
+ ] ? Head extends unknown[] ? ZIP<Tail, [...O, Head[number]]> : never : T extends [] ? O[] : T;
2
5
  export type ZipArrayType<T extends unknown[][]> = ZIP<T>;
3
- export {};
@@ -1,3 +1,2 @@
1
1
  export type Binary1bitNor<X extends `${0 | 1}`, Y extends `${0 | 1}`> = Binary1bitNorParser<X, Y>;
2
- type Binary1bitNorParser<X extends string, Y extends string> = X extends "1" ? "0" : Y extends "1" ? "0" : "1";
3
- export {};
2
+ export type Binary1bitNorParser<X extends string, Y extends string> = X extends "1" ? "0" : Y extends "1" ? "0" : "1";
@@ -5,5 +5,4 @@ import type { LengthOfString } from "./lengthOfString";
5
5
  import type { ShiftString } from "./shiftString";
6
6
  import type { StringReverse } from "./stringReverse";
7
7
  export type BinaryFullAdder<X extends string, Y extends string, B extends number = LengthOfString<X>> = LengthOfString<X> extends LengthOfString<Y> ? FirstNChars<ShiftString<StringReverse<BinaryFullAdderParser<StringReverse<FirstNChars<X, B>>, StringReverse<FirstNChars<Y, B>>>>>, B> : never;
8
- type BinaryFullAdderParser<X extends string, Y extends string, A extends string = "", C extends string = "0"> = X extends `${infer F}${infer R}` ? Y extends `${infer F2}${infer R2}` ? BinaryHalfAdderParser<F, F2> extends `${infer F3}${infer R3}` ? BinaryHalfAdderParser<R3, C> extends `${infer F4}${infer R4}` ? BinaryFullAdderParser<R, R2, `${A}${R4}`, Binary1bitOrParser<F3, F4>> : never : never : never : `${A}${C}`;
9
- export {};
8
+ export type BinaryFullAdderParser<X extends string, Y extends string, A extends string = "", C extends string = "0"> = X extends `${infer F}${infer R}` ? Y extends `${infer F2}${infer R2}` ? BinaryHalfAdderParser<F, F2> extends `${infer F3}${infer R3}` ? BinaryHalfAdderParser<R3, C> extends `${infer F4}${infer R4}` ? BinaryFullAdderParser<R, R2, `${A}${R4}`, Binary1bitOrParser<F3, F4>> : never : never : never : `${A}${C}`;
@@ -2,5 +2,4 @@ import type { Add } from "./add";
2
2
  import type { Subtract } from "./subtract";
3
3
  import type { BGreaterThanA } from "../logic/bGreaterThanA";
4
4
  export type Divide<A extends number, B extends number> = A extends 0 ? never : B extends 0 ? never : `${A}` extends `-${infer N extends number}` ? `${B}` extends `-${infer M extends number}` ? DivideHelper<N, M> : `-${DivideHelper<N, B>}` extends `${infer R extends number}` ? R : never : `${B}` extends `-${infer M extends number}` ? `-${DivideHelper<A, M>}` extends `${infer R extends number}` ? R : never : DivideHelper<A, B>;
5
- type DivideHelper<X extends number, Y extends number, A extends number = 0> = BGreaterThanA<X, Y> extends true ? A : DivideHelper<Subtract<X, Y>, Y, Add<A, 1>>;
6
- export {};
5
+ export type DivideHelper<X extends number, Y extends number, A extends number = 0> = BGreaterThanA<X, Y> extends true ? A : DivideHelper<Subtract<X, Y>, Y, Add<A, 1>>;
@@ -1,5 +1,4 @@
1
1
  import type { Add } from "./add";
2
2
  import type { Subtract } from "./subtract";
3
3
  export type Multiply<A extends number, B extends number> = MultiHelper<A, B>;
4
- type MultiHelper<X extends number, Y extends number, A extends number = 0> = `${X}` extends `-${infer N extends number}` ? `${Y}` extends `-${infer M extends number}` ? MultiHelper<N, M, A> : `-${MultiHelper<N, Y, A>}` extends `${infer R extends number}` ? R : never : `${Y}` extends `-${infer M extends number}` ? `-${MultiHelper<X, M, A>}` extends `${infer R extends number}` ? R : never : Y extends 0 ? A : MultiHelper<X, Subtract<Y, 1>, Add<X, A>>;
5
- export {};
4
+ export type MultiHelper<X extends number, Y extends number, A extends number = 0> = `${X}` extends `-${infer N extends number}` ? `${Y}` extends `-${infer M extends number}` ? MultiHelper<N, M, A> : `-${MultiHelper<N, Y, A>}` extends `${infer R extends number}` ? R : never : `${Y}` extends `-${infer M extends number}` ? `-${MultiHelper<X, M, A>}` extends `${infer R extends number}` ? R : never : Y extends 0 ? A : MultiHelper<X, Subtract<Y, 1>, Add<X, A>>;
@@ -1,13 +1,12 @@
1
1
  import type { PickDeepKey } from "./pickDeepKey";
2
2
  import type { UnionToIntersection } from "../logic/unionToIntersection";
3
- type GetValueAtPath<T, P extends string> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? T[Key] extends object ? GetValueAtPath<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
4
- type ConstructNestedObject<P extends string, V> = P extends `${infer Key}.${infer Rest}` ? {
3
+ export type GetValueAtPath<T, P extends string> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? T[Key] extends object ? GetValueAtPath<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
4
+ export type ConstructNestedObject<P extends string, V> = P extends `${infer Key}.${infer Rest}` ? {
5
5
  [K in Key]: ConstructNestedObject<Rest, V>;
6
6
  } : {
7
7
  [K in P]: V;
8
8
  };
9
- type ProcessKeys<T extends object, K extends readonly PickDeepKey<T>[]> = {
9
+ export type ProcessKeys<T extends object, K extends readonly PickDeepKey<T>[]> = {
10
10
  [I in keyof K]: K[I] extends string ? ConstructNestedObject<K[I], GetValueAtPath<T, K[I]>> : never;
11
11
  }[number];
12
12
  export type PickDeep<T extends object, K extends readonly PickDeepKey<T>[]> = UnionToIntersection<ProcessKeys<T, K>>;
13
- export {};