umt 2.19.0 → 2.20.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/module/Validate/any/core.d.ts +21 -0
- package/module/Validate/any/core.js +19 -0
- package/module/Validate/any/core.js.map +1 -0
- package/module/Validate/any/index.d.ts +1 -0
- package/module/Validate/any/index.js +2 -0
- package/module/Validate/any/index.js.map +1 -0
- package/module/Validate/array/arrayOf.d.ts +6 -1
- package/module/Validate/array/arrayOf.js +1 -0
- package/module/Validate/array/arrayOf.js.map +1 -1
- package/module/Validate/bigint/core.d.ts +24 -0
- package/module/Validate/bigint/core.js +37 -0
- package/module/Validate/bigint/core.js.map +1 -0
- package/module/Validate/bigint/index.d.ts +1 -0
- package/module/Validate/bigint/index.js +2 -0
- package/module/Validate/bigint/index.js.map +1 -0
- package/module/Validate/date/core.d.ts +14 -0
- package/module/Validate/date/core.js +29 -0
- package/module/Validate/date/core.js.map +1 -0
- package/module/Validate/date/index.d.ts +1 -0
- package/module/Validate/date/index.js +2 -0
- package/module/Validate/date/index.js.map +1 -0
- package/module/Validate/file/core.d.ts +13 -0
- package/module/Validate/file/core.js +32 -0
- package/module/Validate/file/core.js.map +1 -0
- package/module/Validate/file/index.d.ts +1 -0
- package/module/Validate/file/index.js +2 -0
- package/module/Validate/file/index.js.map +1 -0
- package/module/Validate/function/core.d.ts +75 -0
- package/module/Validate/function/core.js +66 -0
- package/module/Validate/function/core.js.map +1 -0
- package/module/Validate/function/index.d.ts +1 -0
- package/module/Validate/function/index.js +2 -0
- package/module/Validate/function/index.js.map +1 -0
- package/module/Validate/index.d.ts +11 -0
- package/module/Validate/index.js +11 -0
- package/module/Validate/index.js.map +1 -1
- package/module/Validate/instanceof/core.d.ts +19 -0
- package/module/Validate/instanceof/core.js +32 -0
- package/module/Validate/instanceof/core.js.map +1 -0
- package/module/Validate/instanceof/index.d.ts +1 -0
- package/module/Validate/instanceof/index.js +2 -0
- package/module/Validate/instanceof/index.js.map +1 -0
- package/module/Validate/map/core.d.ts +24 -0
- package/module/Validate/map/core.js +57 -0
- package/module/Validate/map/core.js.map +1 -0
- package/module/Validate/map/index.d.ts +1 -0
- package/module/Validate/map/index.js +2 -0
- package/module/Validate/map/index.js.map +1 -0
- package/module/Validate/never/core.d.ts +22 -0
- package/module/Validate/never/core.js +23 -0
- package/module/Validate/never/core.js.map +1 -0
- package/module/Validate/never/index.d.ts +1 -0
- package/module/Validate/never/index.js +2 -0
- package/module/Validate/never/index.js.map +1 -0
- package/module/Validate/object/core.d.ts +22 -4
- package/module/Validate/object/core.js +5 -3
- package/module/Validate/object/core.js.map +1 -1
- package/module/Validate/object/index.d.ts +4 -0
- package/module/Validate/object/index.js +4 -0
- package/module/Validate/object/index.js.map +1 -1
- package/module/Validate/object/nullable.d.ts +12 -2
- package/module/Validate/object/nullable.js +2 -2
- package/module/Validate/object/nullable.js.map +1 -1
- package/module/Validate/object/omit.d.ts +22 -0
- package/module/Validate/object/omit.js +33 -0
- package/module/Validate/object/omit.js.map +1 -0
- package/module/Validate/object/optional.d.ts +31 -3
- package/module/Validate/object/optional.js +7 -5
- package/module/Validate/object/optional.js.map +1 -1
- package/module/Validate/object/partial.d.ts +25 -0
- package/module/Validate/object/partial.js +29 -0
- package/module/Validate/object/partial.js.map +1 -0
- package/module/Validate/object/pick.d.ts +21 -0
- package/module/Validate/object/pick.js +29 -0
- package/module/Validate/object/pick.js.map +1 -0
- package/module/Validate/object/required.d.ts +22 -0
- package/module/Validate/object/required.js +30 -0
- package/module/Validate/object/required.js.map +1 -0
- package/module/Validate/set/core.d.ts +24 -0
- package/module/Validate/set/core.js +47 -0
- package/module/Validate/set/core.js.map +1 -0
- package/module/Validate/set/index.d.ts +1 -0
- package/module/Validate/set/index.js +2 -0
- package/module/Validate/set/index.js.map +1 -0
- package/module/Validate/templateLiteral/core.d.ts +55 -0
- package/module/Validate/templateLiteral/core.js +68 -0
- package/module/Validate/templateLiteral/core.js.map +1 -0
- package/module/Validate/templateLiteral/index.d.ts +1 -0
- package/module/Validate/templateLiteral/index.js +2 -0
- package/module/Validate/templateLiteral/index.js.map +1 -0
- package/module/Validate/type.d.ts +7 -5
- package/module/Validate/unknown/core.d.ts +21 -0
- package/module/Validate/unknown/core.js +16 -0
- package/module/Validate/unknown/core.js.map +1 -0
- package/module/Validate/unknown/index.d.ts +1 -0
- package/module/Validate/unknown/index.js +2 -0
- package/module/Validate/unknown/index.js.map +1 -0
- package/module/es5/Validate/any/core.d.ts +21 -0
- package/module/es5/Validate/any/core.js +36 -0
- package/module/es5/Validate/any/index.d.ts +1 -0
- package/module/es5/Validate/any/index.js +16 -0
- package/module/es5/Validate/array/arrayOf.d.ts +6 -1
- package/module/es5/Validate/array/arrayOf.js +1 -0
- package/module/es5/Validate/bigint/core.d.ts +24 -0
- package/module/es5/Validate/bigint/core.js +65 -0
- package/module/es5/Validate/bigint/index.d.ts +1 -0
- package/module/es5/Validate/bigint/index.js +16 -0
- package/module/es5/Validate/date/core.d.ts +14 -0
- package/module/es5/Validate/date/core.js +35 -0
- package/module/es5/Validate/date/index.d.ts +1 -0
- package/module/es5/Validate/date/index.js +16 -0
- package/module/es5/Validate/file/core.d.ts +13 -0
- package/module/es5/Validate/file/core.js +39 -0
- package/module/es5/Validate/file/index.d.ts +1 -0
- package/module/es5/Validate/file/index.js +16 -0
- package/module/es5/Validate/function/core.d.ts +75 -0
- package/module/es5/Validate/function/core.js +125 -0
- package/module/es5/Validate/function/index.d.ts +1 -0
- package/module/es5/Validate/function/index.js +16 -0
- package/module/es5/Validate/index.d.ts +11 -0
- package/module/es5/Validate/index.js +121 -0
- package/module/es5/Validate/instanceof/core.d.ts +19 -0
- package/module/es5/Validate/instanceof/core.js +40 -0
- package/module/es5/Validate/instanceof/index.d.ts +1 -0
- package/module/es5/Validate/instanceof/index.js +16 -0
- package/module/es5/Validate/map/core.d.ts +24 -0
- package/module/es5/Validate/map/core.js +81 -0
- package/module/es5/Validate/map/index.d.ts +1 -0
- package/module/es5/Validate/map/index.js +16 -0
- package/module/es5/Validate/never/core.d.ts +22 -0
- package/module/es5/Validate/never/core.js +35 -0
- package/module/es5/Validate/never/index.d.ts +1 -0
- package/module/es5/Validate/never/index.js +16 -0
- package/module/es5/Validate/object/core.d.ts +22 -4
- package/module/es5/Validate/object/core.js +14 -2
- package/module/es5/Validate/object/index.d.ts +4 -0
- package/module/es5/Validate/object/index.js +44 -0
- package/module/es5/Validate/object/nullable.d.ts +12 -2
- package/module/es5/Validate/object/nullable.js +2 -2
- package/module/es5/Validate/object/omit.d.ts +22 -0
- package/module/es5/Validate/object/omit.js +39 -0
- package/module/es5/Validate/object/optional.d.ts +31 -3
- package/module/es5/Validate/object/optional.js +12 -3
- package/module/es5/Validate/object/partial.d.ts +25 -0
- package/module/es5/Validate/object/partial.js +33 -0
- package/module/es5/Validate/object/pick.d.ts +21 -0
- package/module/es5/Validate/object/pick.js +45 -0
- package/module/es5/Validate/object/required.d.ts +22 -0
- package/module/es5/Validate/object/required.js +33 -0
- package/module/es5/Validate/set/core.d.ts +24 -0
- package/module/es5/Validate/set/core.js +65 -0
- package/module/es5/Validate/set/index.d.ts +1 -0
- package/module/es5/Validate/set/index.js +16 -0
- package/module/es5/Validate/templateLiteral/core.d.ts +55 -0
- package/module/es5/Validate/templateLiteral/core.js +114 -0
- package/module/es5/Validate/templateLiteral/index.d.ts +1 -0
- package/module/es5/Validate/templateLiteral/index.js +16 -0
- package/module/es5/Validate/type.d.ts +7 -5
- package/module/es5/Validate/unknown/core.d.ts +21 -0
- package/module/es5/Validate/unknown/core.js +34 -0
- package/module/es5/Validate/unknown/index.d.ts +1 -0
- package/module/es5/Validate/unknown/index.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _core = require("./core");
|
|
7
|
+
Object.keys(_core).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _core[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _core[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function validation core module
|
|
3
|
+
* Provides a validator for function values along with an `implement()`
|
|
4
|
+
* helper that wraps a concrete function with runtime validation of its
|
|
5
|
+
* inputs and output.
|
|
6
|
+
*
|
|
7
|
+
* The runtime validator only enforces that the value is a function, since
|
|
8
|
+
* argument and return-value contracts can only be checked when the function
|
|
9
|
+
* is actually invoked. Use `.implement()` (or call the validator's
|
|
10
|
+
* `implement` property directly) to create a wrapped function that asserts
|
|
11
|
+
* the schema on every call.
|
|
12
|
+
*/
|
|
13
|
+
import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
14
|
+
type AnyValidator = (value: any) => ValidateCoreReturnType<unknown>;
|
|
15
|
+
type ExtractValidatedType<V> = V extends (value: never) => {
|
|
16
|
+
type: infer T;
|
|
17
|
+
} ? ValidateType<T> : never;
|
|
18
|
+
type InferInputs<Inputs> = Inputs extends readonly AnyValidator[] ? {
|
|
19
|
+
[K in keyof Inputs]: ExtractValidatedType<Inputs[K]>;
|
|
20
|
+
} : any[];
|
|
21
|
+
type InferOutput<Output> = Output extends AnyValidator ? ExtractValidatedType<Output> : any;
|
|
22
|
+
/**
|
|
23
|
+
* Function schema definition. `input` describes positional parameters and
|
|
24
|
+
* `output` describes the return type. Both are optional; when omitted the
|
|
25
|
+
* validator only enforces that the value is callable.
|
|
26
|
+
*/
|
|
27
|
+
export interface FunctionSchema {
|
|
28
|
+
input?: readonly AnyValidator[];
|
|
29
|
+
output?: AnyValidator;
|
|
30
|
+
}
|
|
31
|
+
type ExtractInput<S> = S extends {
|
|
32
|
+
input: infer I;
|
|
33
|
+
} ? I : undefined;
|
|
34
|
+
type ExtractOutput<S> = S extends {
|
|
35
|
+
output: infer O;
|
|
36
|
+
} ? O : undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Inferred function signature from a `FunctionSchema`. Used by callers via
|
|
39
|
+
* `SchemaToInterface` and as the return type of `implement()`.
|
|
40
|
+
* @template Inputs - Tuple of validators describing positional parameters
|
|
41
|
+
* @template Output - Validator describing the return value
|
|
42
|
+
*/
|
|
43
|
+
export type InferFunction<Inputs, Output> = (...arguments_: InferInputs<Inputs>) => InferOutput<Output>;
|
|
44
|
+
/**
|
|
45
|
+
* Validator return type. Carries the inferred function signature through
|
|
46
|
+
* the `type` field so `SchemaToInterface` can recover it.
|
|
47
|
+
* @template Inputs - Tuple of validators describing positional parameters
|
|
48
|
+
* @template Output - Validator describing the return value
|
|
49
|
+
*/
|
|
50
|
+
export interface FunctionReturnType<Inputs, Output> {
|
|
51
|
+
validate: boolean;
|
|
52
|
+
message: string;
|
|
53
|
+
type: InferFunction<Inputs, Output>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Validator value enriched with an `implement()` method that returns a
|
|
57
|
+
* runtime-checked wrapper of a concrete function matching the schema.
|
|
58
|
+
* @template Inputs - Tuple of validators describing positional parameters
|
|
59
|
+
* @template Output - Validator describing the return value
|
|
60
|
+
*/
|
|
61
|
+
export interface FunctionValidator<Inputs, Output> {
|
|
62
|
+
(value: InferFunction<Inputs, Output>): FunctionReturnType<Inputs, Output>;
|
|
63
|
+
implement: (function__: InferFunction<Inputs, Output>) => InferFunction<Inputs, Output>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates a function validator. When invoked the validator only checks that
|
|
67
|
+
* the value is callable; use `.implement()` on the returned validator to
|
|
68
|
+
* obtain a runtime-checked wrapper that asserts the schema for each call.
|
|
69
|
+
* @template S - Function schema type, captured for input/output inference
|
|
70
|
+
* @param {S} [schema] - Function schema definition
|
|
71
|
+
* @param {string} [message] - Custom error message for type validation
|
|
72
|
+
* @returns {FunctionValidator} - Validator augmented with `implement()`
|
|
73
|
+
*/
|
|
74
|
+
export declare const function_: <const S extends FunctionSchema = FunctionSchema>(schema?: S, message?: string) => FunctionValidator<ExtractInput<S>, ExtractOutput<S>>;
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.function_ = void 0;
|
|
7
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
11
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
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; } } }; }
|
|
16
|
+
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; } }
|
|
17
|
+
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; }
|
|
18
|
+
/**
|
|
19
|
+
* Function validation core module
|
|
20
|
+
* Provides a validator for function values along with an `implement()`
|
|
21
|
+
* helper that wraps a concrete function with runtime validation of its
|
|
22
|
+
* inputs and output.
|
|
23
|
+
*
|
|
24
|
+
* The runtime validator only enforces that the value is a function, since
|
|
25
|
+
* argument and return-value contracts can only be checked when the function
|
|
26
|
+
* is actually invoked. Use `.implement()` (or call the validator's
|
|
27
|
+
* `implement` property directly) to create a wrapped function that asserts
|
|
28
|
+
* the schema on every call.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// biome-ignore lint/suspicious/noExplicitAny: validator signatures vary
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Function schema definition. `input` describes positional parameters and
|
|
35
|
+
* `output` describes the return type. Both are optional; when omitted the
|
|
36
|
+
* validator only enforces that the value is callable.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Inferred function signature from a `FunctionSchema`. Used by callers via
|
|
41
|
+
* `SchemaToInterface` and as the return type of `implement()`.
|
|
42
|
+
* @template Inputs - Tuple of validators describing positional parameters
|
|
43
|
+
* @template Output - Validator describing the return value
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Validator return type. Carries the inferred function signature through
|
|
48
|
+
* the `type` field so `SchemaToInterface` can recover it.
|
|
49
|
+
* @template Inputs - Tuple of validators describing positional parameters
|
|
50
|
+
* @template Output - Validator describing the return value
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Validator value enriched with an `implement()` method that returns a
|
|
55
|
+
* runtime-checked wrapper of a concrete function matching the schema.
|
|
56
|
+
* @template Inputs - Tuple of validators describing positional parameters
|
|
57
|
+
* @template Output - Validator describing the return value
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Creates a function validator. When invoked the validator only checks that
|
|
62
|
+
* the value is callable; use `.implement()` on the returned validator to
|
|
63
|
+
* obtain a runtime-checked wrapper that asserts the schema for each call.
|
|
64
|
+
* @template S - Function schema type, captured for input/output inference
|
|
65
|
+
* @param {S} [schema] - Function schema definition
|
|
66
|
+
* @param {string} [message] - Custom error message for type validation
|
|
67
|
+
* @returns {FunctionValidator} - Validator augmented with `implement()`
|
|
68
|
+
*/
|
|
69
|
+
var function_ = exports.function_ = function function_(schema, message) {
|
|
70
|
+
var inputs = schema === null || schema === void 0 ? void 0 : schema.input;
|
|
71
|
+
var output = schema === null || schema === void 0 ? void 0 : schema.output;
|
|
72
|
+
var validator = function validator(value) {
|
|
73
|
+
if (typeof value !== "function") {
|
|
74
|
+
return {
|
|
75
|
+
validate: false,
|
|
76
|
+
message: message !== null && message !== void 0 ? message : "",
|
|
77
|
+
type: value
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
validate: true,
|
|
82
|
+
message: "",
|
|
83
|
+
type: value
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
validator.implement = function (function__) {
|
|
87
|
+
if (typeof function__ !== "function") {
|
|
88
|
+
throw new TypeError(message !== null && message !== void 0 ? message : "value is not a function");
|
|
89
|
+
}
|
|
90
|
+
var wrapped = function wrapped() {
|
|
91
|
+
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
92
|
+
arguments_[_key] = arguments[_key];
|
|
93
|
+
}
|
|
94
|
+
if (inputs) {
|
|
95
|
+
var _iterator = _createForOfIteratorHelper(inputs.entries()),
|
|
96
|
+
_step;
|
|
97
|
+
try {
|
|
98
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
99
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
100
|
+
index = _step$value[0],
|
|
101
|
+
inputValidator = _step$value[1];
|
|
102
|
+
var result = inputValidator(arguments_[index]);
|
|
103
|
+
if (!result.validate) {
|
|
104
|
+
throw new TypeError(result.message || "function input at index ".concat(index, " failed validation"));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
} catch (err) {
|
|
108
|
+
_iterator.e(err);
|
|
109
|
+
} finally {
|
|
110
|
+
_iterator.f();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
var returnValue = function__.apply(void 0, _toConsumableArray(arguments_));
|
|
114
|
+
if (output) {
|
|
115
|
+
var _result = output(returnValue);
|
|
116
|
+
if (!_result.validate) {
|
|
117
|
+
throw new TypeError(_result.message || "function output failed validation");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return returnValue;
|
|
121
|
+
};
|
|
122
|
+
return wrapped;
|
|
123
|
+
};
|
|
124
|
+
return validator;
|
|
125
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./core";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _core = require("./core");
|
|
7
|
+
Object.keys(_core).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _core[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _core[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
export * from "./any";
|
|
1
2
|
export * from "./array";
|
|
3
|
+
export * from "./bigint";
|
|
2
4
|
export * from "./boolean";
|
|
5
|
+
export * from "./date";
|
|
6
|
+
export * from "./file";
|
|
7
|
+
export * from "./function";
|
|
8
|
+
export * from "./instanceof";
|
|
9
|
+
export * from "./map";
|
|
10
|
+
export * from "./never";
|
|
3
11
|
export * from "./number";
|
|
4
12
|
export * from "./object";
|
|
13
|
+
export * from "./set";
|
|
5
14
|
export * from "./string";
|
|
15
|
+
export * from "./templateLiteral";
|
|
6
16
|
export * from "./type";
|
|
17
|
+
export * from "./unknown";
|
|
7
18
|
export * from "./isDeepEqual";
|
|
8
19
|
export * from "./isArray";
|
|
9
20
|
export * from "./isBrowser";
|
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _any = require("./any");
|
|
7
|
+
Object.keys(_any).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _any[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _any[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
6
17
|
var _array = require("./array");
|
|
7
18
|
Object.keys(_array).forEach(function (key) {
|
|
8
19
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -14,6 +25,17 @@ Object.keys(_array).forEach(function (key) {
|
|
|
14
25
|
}
|
|
15
26
|
});
|
|
16
27
|
});
|
|
28
|
+
var _bigint = require("./bigint");
|
|
29
|
+
Object.keys(_bigint).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _bigint[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _bigint[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
17
39
|
var _boolean = require("./boolean");
|
|
18
40
|
Object.keys(_boolean).forEach(function (key) {
|
|
19
41
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -25,6 +47,72 @@ Object.keys(_boolean).forEach(function (key) {
|
|
|
25
47
|
}
|
|
26
48
|
});
|
|
27
49
|
});
|
|
50
|
+
var _date = require("./date");
|
|
51
|
+
Object.keys(_date).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _date[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _date[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _file = require("./file");
|
|
62
|
+
Object.keys(_file).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _file[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function get() {
|
|
68
|
+
return _file[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _function = require("./function");
|
|
73
|
+
Object.keys(_function).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _function[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function get() {
|
|
79
|
+
return _function[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _instanceof = require("./instanceof");
|
|
84
|
+
Object.keys(_instanceof).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _instanceof[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function get() {
|
|
90
|
+
return _instanceof[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _map = require("./map");
|
|
95
|
+
Object.keys(_map).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _map[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function get() {
|
|
101
|
+
return _map[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
var _never = require("./never");
|
|
106
|
+
Object.keys(_never).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _never[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function get() {
|
|
112
|
+
return _never[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
28
116
|
var _number = require("./number");
|
|
29
117
|
Object.keys(_number).forEach(function (key) {
|
|
30
118
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -47,6 +135,17 @@ Object.keys(_object).forEach(function (key) {
|
|
|
47
135
|
}
|
|
48
136
|
});
|
|
49
137
|
});
|
|
138
|
+
var _set = require("./set");
|
|
139
|
+
Object.keys(_set).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _set[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function get() {
|
|
145
|
+
return _set[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
50
149
|
var _string = require("./string");
|
|
51
150
|
Object.keys(_string).forEach(function (key) {
|
|
52
151
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -58,6 +157,17 @@ Object.keys(_string).forEach(function (key) {
|
|
|
58
157
|
}
|
|
59
158
|
});
|
|
60
159
|
});
|
|
160
|
+
var _templateLiteral = require("./templateLiteral");
|
|
161
|
+
Object.keys(_templateLiteral).forEach(function (key) {
|
|
162
|
+
if (key === "default" || key === "__esModule") return;
|
|
163
|
+
if (key in exports && exports[key] === _templateLiteral[key]) return;
|
|
164
|
+
Object.defineProperty(exports, key, {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function get() {
|
|
167
|
+
return _templateLiteral[key];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
61
171
|
var _type = require("./type");
|
|
62
172
|
Object.keys(_type).forEach(function (key) {
|
|
63
173
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -69,6 +179,17 @@ Object.keys(_type).forEach(function (key) {
|
|
|
69
179
|
}
|
|
70
180
|
});
|
|
71
181
|
});
|
|
182
|
+
var _unknown = require("./unknown");
|
|
183
|
+
Object.keys(_unknown).forEach(function (key) {
|
|
184
|
+
if (key === "default" || key === "__esModule") return;
|
|
185
|
+
if (key in exports && exports[key] === _unknown[key]) return;
|
|
186
|
+
Object.defineProperty(exports, key, {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function get() {
|
|
189
|
+
return _unknown[key];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
72
193
|
var _isDeepEqual = require("./isDeepEqual");
|
|
73
194
|
Object.keys(_isDeepEqual).forEach(function (key) {
|
|
74
195
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* instanceof validation core module
|
|
3
|
+
* Provides a validator that checks whether a value is an instance of a
|
|
4
|
+
* specific constructor, including subclasses. The validator is exported as
|
|
5
|
+
* `instanceof_` because `instanceof` is a reserved keyword in JavaScript.
|
|
6
|
+
*/
|
|
7
|
+
import type { ValidateCoreReturnType } from "../../Validate/type";
|
|
8
|
+
type Constructor<T> = new (...arguments_: any[]) => T;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a validator that checks whether a value is an instance of the given
|
|
11
|
+
* constructor. Subclasses of the constructor satisfy the validator, matching
|
|
12
|
+
* native `instanceof` semantics.
|
|
13
|
+
* @template T - The instance type produced by the constructor
|
|
14
|
+
* @param {Constructor<T>} classConstructor - Constructor whose instances are accepted
|
|
15
|
+
* @param {string} [message] - Custom error message for validation failure
|
|
16
|
+
* @returns {Function} - Validator function for instances of the constructor
|
|
17
|
+
*/
|
|
18
|
+
export declare const instanceof_: <T>(classConstructor: Constructor<T>, message?: string) => (value: T) => ValidateCoreReturnType<T>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.instanceof_ = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* instanceof validation core module
|
|
9
|
+
* Provides a validator that checks whether a value is an instance of a
|
|
10
|
+
* specific constructor, including subclasses. The validator is exported as
|
|
11
|
+
* `instanceof_` because `instanceof` is a reserved keyword in JavaScript.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// biome-ignore lint/suspicious/noExplicitAny: a constructor signature must accept any tuple
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a validator that checks whether a value is an instance of the given
|
|
18
|
+
* constructor. Subclasses of the constructor satisfy the validator, matching
|
|
19
|
+
* native `instanceof` semantics.
|
|
20
|
+
* @template T - The instance type produced by the constructor
|
|
21
|
+
* @param {Constructor<T>} classConstructor - Constructor whose instances are accepted
|
|
22
|
+
* @param {string} [message] - Custom error message for validation failure
|
|
23
|
+
* @returns {Function} - Validator function for instances of the constructor
|
|
24
|
+
*/
|
|
25
|
+
var instanceof_ = exports.instanceof_ = function instanceof_(classConstructor, message) {
|
|
26
|
+
return function (value) {
|
|
27
|
+
if (!(value instanceof classConstructor)) {
|
|
28
|
+
return {
|
|
29
|
+
validate: false,
|
|
30
|
+
message: message !== null && message !== void 0 ? message : "",
|
|
31
|
+
type: value
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
validate: true,
|
|
36
|
+
message: "",
|
|
37
|
+
type: value
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./core";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _core = require("./core");
|
|
7
|
+
Object.keys(_core).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _core[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _core[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map validation core module
|
|
3
|
+
* Provides validation for `Map` instances. The validator can optionally
|
|
4
|
+
* delegate to per-entry validators for keys and values, mirroring how
|
|
5
|
+
* `arrayOf()` validates each element of an array.
|
|
6
|
+
*/
|
|
7
|
+
import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
|
|
8
|
+
type ExtractValidatedType<V> = V extends (value: never) => {
|
|
9
|
+
type: infer T;
|
|
10
|
+
} ? ValidateType<T> : never;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Map validator. The validator can optionally accept per-entry key
|
|
13
|
+
* and value validators that are applied to every entry of the map. When the
|
|
14
|
+
* value-side validator is provided, the entry validators short-circuit on the
|
|
15
|
+
* first failure and surface the failing message, mirroring `arrayOf()`.
|
|
16
|
+
* @template KV - Validator for the map key
|
|
17
|
+
* @template VV - Validator for the map value
|
|
18
|
+
* @param {KV} [keyValidator] - Validator applied to every key
|
|
19
|
+
* @param {VV} [valueValidator] - Validator applied to every value
|
|
20
|
+
* @param {string} [message] - Custom error message for type validation
|
|
21
|
+
* @returns {Function} - Validator function for Map instances
|
|
22
|
+
*/
|
|
23
|
+
export declare const map: <KV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, VV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, K = ExtractValidatedType<KV>, V = ExtractValidatedType<VV>>(keyValidator?: KV, valueValidator?: VV, message?: string) => (value: Map<K, V>) => ValidateCoreReturnType<Map<K, V>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.map = void 0;
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
|
+
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; } } }; }
|
|
12
|
+
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; } }
|
|
13
|
+
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; }
|
|
14
|
+
/**
|
|
15
|
+
* Map validation core module
|
|
16
|
+
* Provides validation for `Map` instances. The validator can optionally
|
|
17
|
+
* delegate to per-entry validators for keys and values, mirroring how
|
|
18
|
+
* `arrayOf()` validates each element of an array.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a Map validator. The validator can optionally accept per-entry key
|
|
23
|
+
* and value validators that are applied to every entry of the map. When the
|
|
24
|
+
* value-side validator is provided, the entry validators short-circuit on the
|
|
25
|
+
* first failure and surface the failing message, mirroring `arrayOf()`.
|
|
26
|
+
* @template KV - Validator for the map key
|
|
27
|
+
* @template VV - Validator for the map value
|
|
28
|
+
* @param {KV} [keyValidator] - Validator applied to every key
|
|
29
|
+
* @param {VV} [valueValidator] - Validator applied to every value
|
|
30
|
+
* @param {string} [message] - Custom error message for type validation
|
|
31
|
+
* @returns {Function} - Validator function for Map instances
|
|
32
|
+
*/
|
|
33
|
+
var map = exports.map = function map(keyValidator, valueValidator, message) {
|
|
34
|
+
return function (value) {
|
|
35
|
+
if (!(value instanceof Map)) {
|
|
36
|
+
return {
|
|
37
|
+
validate: false,
|
|
38
|
+
message: message !== null && message !== void 0 ? message : "",
|
|
39
|
+
type: value
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var _iterator = _createForOfIteratorHelper(value),
|
|
43
|
+
_step;
|
|
44
|
+
try {
|
|
45
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
46
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
47
|
+
entryKey = _step$value[0],
|
|
48
|
+
entryValue = _step$value[1];
|
|
49
|
+
if (keyValidator) {
|
|
50
|
+
var keyResult = keyValidator(entryKey);
|
|
51
|
+
if (!keyResult.validate) {
|
|
52
|
+
return {
|
|
53
|
+
validate: false,
|
|
54
|
+
message: keyResult.message,
|
|
55
|
+
type: value
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (valueValidator) {
|
|
60
|
+
var valueResult = valueValidator(entryValue);
|
|
61
|
+
if (!valueResult.validate) {
|
|
62
|
+
return {
|
|
63
|
+
validate: false,
|
|
64
|
+
message: valueResult.message,
|
|
65
|
+
type: value
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} catch (err) {
|
|
71
|
+
_iterator.e(err);
|
|
72
|
+
} finally {
|
|
73
|
+
_iterator.f();
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
validate: true,
|
|
77
|
+
message: "",
|
|
78
|
+
type: value
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./core";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _core = require("./core");
|
|
7
|
+
Object.keys(_core).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _core[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _core[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Never validation core module
|
|
3
|
+
* Provides a validator that fails for every input, useful for marking
|
|
4
|
+
* positions in a schema that must never be filled (for example, exhaustive
|
|
5
|
+
* union members that should be unreachable at the type level).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Return type produced by a `never` validator. Exposes the literal `"never"`
|
|
9
|
+
* tag through the `type` field so `ValidateType<"never">` can map it back to
|
|
10
|
+
* the `never` runtime type when consumed by downstream helpers.
|
|
11
|
+
*/
|
|
12
|
+
export interface NeverReturnType {
|
|
13
|
+
validate: boolean;
|
|
14
|
+
message: string;
|
|
15
|
+
type: "never";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a validator that always fails
|
|
19
|
+
* @param {string} [message] - Custom error message for validation failure
|
|
20
|
+
* @returns {Function} - Validator that always returns a failing result
|
|
21
|
+
*/
|
|
22
|
+
export declare const never: (message?: string) => ((value: any) => NeverReturnType);
|