@sinclair/typebox 0.32.33 → 0.32.34
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/build/cjs/errors/errors.js +2 -2
- package/build/cjs/errors/function.js +3 -4
- package/build/cjs/type/any/any.js +1 -2
- package/build/cjs/type/array/array.js +1 -2
- package/build/cjs/type/async-iterator/async-iterator.js +1 -2
- package/build/cjs/type/awaited/awaited.js +1 -2
- package/build/cjs/type/bigint/bigint.js +1 -2
- package/build/cjs/type/boolean/boolean.js +1 -2
- package/build/cjs/type/clone/type.js +2 -3
- package/build/cjs/type/clone/value.js +1 -2
- package/build/cjs/type/composite/composite.js +1 -2
- package/build/cjs/type/const/const.js +1 -2
- package/build/cjs/type/constructor/constructor.js +1 -2
- package/build/cjs/type/constructor-parameters/constructor-parameters.js +1 -2
- package/build/cjs/type/date/date.js +1 -2
- package/build/cjs/type/deref/deref.js +1 -2
- package/build/cjs/type/discard/discard.js +1 -2
- package/build/cjs/type/enum/enum.js +1 -2
- package/build/cjs/type/exclude/exclude-from-mapped-result.js +1 -2
- package/build/cjs/type/exclude/exclude-from-template-literal.js +1 -2
- package/build/cjs/type/exclude/exclude.js +1 -2
- package/build/cjs/type/extends/extends-check.js +2 -2
- package/build/cjs/type/extends/extends-from-mapped-key.js +1 -2
- package/build/cjs/type/extends/extends-from-mapped-result.js +1 -2
- package/build/cjs/type/extends/extends-undefined.js +1 -2
- package/build/cjs/type/extends/extends.js +1 -2
- package/build/cjs/type/extract/extract-from-mapped-result.js +1 -2
- package/build/cjs/type/extract/extract-from-template-literal.js +1 -2
- package/build/cjs/type/extract/extract.js +1 -2
- package/build/cjs/type/function/function.js +1 -2
- package/build/cjs/type/guard/kind.js +45 -46
- package/build/cjs/type/guard/type.js +48 -48
- package/build/cjs/type/guard/value.js +15 -16
- package/build/cjs/type/helpers/helpers.js +1 -2
- package/build/cjs/type/indexed/indexed-from-mapped-key.js +1 -2
- package/build/cjs/type/indexed/indexed-from-mapped-result.js +1 -2
- package/build/cjs/type/indexed/indexed-property-keys.js +1 -2
- package/build/cjs/type/indexed/indexed.js +3 -4
- package/build/cjs/type/instance-type/instance-type.js +1 -2
- package/build/cjs/type/integer/integer.js +1 -2
- package/build/cjs/type/intersect/intersect-create.js +1 -2
- package/build/cjs/type/intersect/intersect-evaluated.js +1 -2
- package/build/cjs/type/intersect/intersect.js +1 -2
- package/build/cjs/type/intrinsic/capitalize.js +1 -2
- package/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js +1 -2
- package/build/cjs/type/intrinsic/intrinsic.js +1 -2
- package/build/cjs/type/intrinsic/lowercase.js +1 -2
- package/build/cjs/type/intrinsic/uncapitalize.js +1 -2
- package/build/cjs/type/intrinsic/uppercase.js +1 -2
- package/build/cjs/type/iterator/iterator.js +1 -2
- package/build/cjs/type/keyof/keyof-from-mapped-result.js +1 -2
- package/build/cjs/type/keyof/keyof-property-entries.js +1 -2
- package/build/cjs/type/keyof/keyof-property-keys.js +2 -3
- package/build/cjs/type/keyof/keyof.js +2 -3
- package/build/cjs/type/literal/literal.js +1 -2
- package/build/cjs/type/mapped/mapped-key.js +1 -2
- package/build/cjs/type/mapped/mapped-result.js +1 -2
- package/build/cjs/type/mapped/mapped.js +2 -3
- package/build/cjs/type/never/never.js +1 -2
- package/build/cjs/type/not/not.js +1 -2
- package/build/cjs/type/null/null.js +1 -2
- package/build/cjs/type/number/number.js +1 -2
- package/build/cjs/type/omit/omit-from-mapped-key.js +1 -2
- package/build/cjs/type/omit/omit-from-mapped-result.js +1 -2
- package/build/cjs/type/omit/omit.js +1 -2
- package/build/cjs/type/optional/optional-from-mapped-result.js +1 -2
- package/build/cjs/type/optional/optional.js +1 -2
- package/build/cjs/type/parameters/parameters.js +1 -2
- package/build/cjs/type/partial/partial-from-mapped-result.js +1 -2
- package/build/cjs/type/partial/partial.js +1 -2
- package/build/cjs/type/pick/pick-from-mapped-key.js +1 -2
- package/build/cjs/type/pick/pick-from-mapped-result.js +1 -2
- package/build/cjs/type/pick/pick.d.ts +2 -2
- package/build/cjs/type/pick/pick.js +1 -2
- package/build/cjs/type/promise/promise.js +1 -2
- package/build/cjs/type/readonly/readonly-from-mapped-result.js +1 -2
- package/build/cjs/type/readonly/readonly.js +1 -2
- package/build/cjs/type/readonly-optional/readonly-optional.js +1 -2
- package/build/cjs/type/record/record.js +1 -2
- package/build/cjs/type/recursive/recursive.js +1 -2
- package/build/cjs/type/ref/ref.js +1 -2
- package/build/cjs/type/regexp/regexp.js +1 -2
- package/build/cjs/type/registry/format.js +6 -7
- package/build/cjs/type/registry/type.js +6 -7
- package/build/cjs/type/required/required-from-mapped-result.js +1 -2
- package/build/cjs/type/required/required.js +1 -2
- package/build/cjs/type/rest/rest.js +1 -2
- package/build/cjs/type/return-type/return-type.js +1 -2
- package/build/cjs/type/sets/set.js +8 -9
- package/build/cjs/type/strict/strict.js +1 -2
- package/build/cjs/type/string/string.js +1 -2
- package/build/cjs/type/symbol/symbol.js +1 -2
- package/build/cjs/type/template-literal/finite.js +3 -3
- package/build/cjs/type/template-literal/generate.d.ts +1 -1
- package/build/cjs/type/template-literal/generate.js +3 -3
- package/build/cjs/type/template-literal/parse.js +3 -3
- package/build/cjs/type/template-literal/pattern.js +2 -2
- package/build/cjs/type/template-literal/syntax.js +1 -2
- package/build/cjs/type/template-literal/template-literal.js +1 -2
- package/build/cjs/type/template-literal/union.js +1 -2
- package/build/cjs/type/transform/transform.js +2 -2
- package/build/cjs/type/tuple/tuple.js +1 -2
- package/build/cjs/type/type/index.d.ts +1 -1
- package/build/cjs/type/uint8array/uint8array.js +1 -2
- package/build/cjs/type/undefined/undefined.js +1 -2
- package/build/cjs/type/union/union-create.js +1 -2
- package/build/cjs/type/union/union-evaluated.js +1 -2
- package/build/cjs/type/union/union.js +1 -2
- package/build/cjs/type/unknown/unknown.js +1 -2
- package/build/cjs/type/unsafe/unsafe.js +1 -2
- package/build/cjs/type/void/void.js +1 -2
- package/build/cjs/value/cast/cast.js +2 -2
- package/build/cjs/value/check/check.js +2 -2
- package/build/cjs/value/clean/clean.js +1 -2
- package/build/cjs/value/clone/clone.js +1 -2
- package/build/cjs/value/convert/convert.js +1 -2
- package/build/cjs/value/create/create.js +2 -2
- package/build/cjs/value/default/default.js +1 -2
- package/build/cjs/value/delta/delta.js +3 -3
- package/build/cjs/value/deref/deref.js +2 -2
- package/build/cjs/value/equal/equal.js +1 -2
- package/build/cjs/value/guard/guard.js +34 -35
- package/build/cjs/value/hash/hash.js +2 -2
- package/build/cjs/value/mutate/mutate.js +2 -2
- package/build/cjs/value/pointer/pointer.js +6 -6
- package/build/cjs/value/transform/decode.js +2 -2
- package/build/cjs/value/transform/encode.js +2 -2
- package/build/cjs/value/transform/has.js +1 -2
- package/build/cjs/value/value/value.js +15 -16
- package/build/esm/type/pick/pick.d.mts +2 -2
- package/build/esm/type/template-literal/generate.d.mts +1 -1
- package/build/esm/type/type/index.d.mts +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.UnionCreate =
|
|
4
|
+
exports.UnionCreate = UnionCreate;
|
|
5
5
|
const type_1 = require("../clone/type");
|
|
6
6
|
const index_1 = require("../symbols/index");
|
|
7
7
|
function UnionCreate(T, options) {
|
|
8
8
|
return { ...options, [index_1.Kind]: 'Union', anyOf: (0, type_1.CloneRest)(T) };
|
|
9
9
|
}
|
|
10
|
-
exports.UnionCreate = UnionCreate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.UnionEvaluated =
|
|
4
|
+
exports.UnionEvaluated = UnionEvaluated;
|
|
5
5
|
const index_1 = require("../symbols/index");
|
|
6
6
|
const type_1 = require("../clone/type");
|
|
7
7
|
const index_2 = require("../discard/index");
|
|
@@ -37,4 +37,3 @@ function UnionEvaluated(T, options = {}) {
|
|
|
37
37
|
T.length === 1 ? (0, type_1.CloneType)(T[0], options) :
|
|
38
38
|
ResolveUnion(T, options));
|
|
39
39
|
}
|
|
40
|
-
exports.UnionEvaluated = UnionEvaluated;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Union =
|
|
4
|
+
exports.Union = Union;
|
|
5
5
|
const index_1 = require("../never/index");
|
|
6
6
|
const type_1 = require("../clone/type");
|
|
7
7
|
const union_create_1 = require("./union-create");
|
|
@@ -12,4 +12,3 @@ function Union(T, options = {}) {
|
|
|
12
12
|
T.length === 1 ? (0, type_1.CloneType)(T[0], options) :
|
|
13
13
|
(0, union_create_1.UnionCreate)(T, options));
|
|
14
14
|
}
|
|
15
|
-
exports.Union = Union;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Unknown =
|
|
4
|
+
exports.Unknown = Unknown;
|
|
5
5
|
const index_1 = require("../symbols/index");
|
|
6
6
|
/** `[Json]` Creates an Unknown type */
|
|
7
7
|
function Unknown(options = {}) {
|
|
@@ -10,4 +10,3 @@ function Unknown(options = {}) {
|
|
|
10
10
|
[index_1.Kind]: 'Unknown',
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
exports.Unknown = Unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Unsafe =
|
|
4
|
+
exports.Unsafe = Unsafe;
|
|
5
5
|
const index_1 = require("../symbols/index");
|
|
6
6
|
/** `[Json]` Creates a Unsafe type that will infers as the generic argument T */
|
|
7
7
|
function Unsafe(options = {}) {
|
|
@@ -10,4 +10,3 @@ function Unsafe(options = {}) {
|
|
|
10
10
|
[index_1.Kind]: options[index_1.Kind] ?? 'Unsafe',
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
exports.Unsafe = Unsafe;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Void =
|
|
4
|
+
exports.Void = Void;
|
|
5
5
|
const index_1 = require("../symbols/index");
|
|
6
6
|
/** `[JavaScript]` Creates a Void type */
|
|
7
7
|
function Void(options = {}) {
|
|
@@ -11,4 +11,3 @@ function Void(options = {}) {
|
|
|
11
11
|
type: 'void',
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
exports.Void = Void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ValueCastError = void 0;
|
|
5
|
+
exports.Cast = Cast;
|
|
5
6
|
const index_1 = require("../guard/index");
|
|
6
7
|
const index_2 = require("../../type/error/index");
|
|
7
8
|
const index_3 = require("../../type/symbols/index");
|
|
@@ -210,4 +211,3 @@ function Visit(schema, references, value) {
|
|
|
210
211
|
function Cast(...args) {
|
|
211
212
|
return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]);
|
|
212
213
|
}
|
|
213
|
-
exports.Cast = Cast;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ValueCheckUnknownTypeError = void 0;
|
|
5
|
+
exports.Check = Check;
|
|
5
6
|
const index_1 = require("../../system/index");
|
|
6
7
|
const index_2 = require("../deref/index");
|
|
7
8
|
const index_3 = require("../hash/index");
|
|
@@ -460,4 +461,3 @@ function Visit(schema, references, value) {
|
|
|
460
461
|
function Check(...args) {
|
|
461
462
|
return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]);
|
|
462
463
|
}
|
|
463
|
-
exports.Check = Check;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Clean =
|
|
4
|
+
exports.Clean = Clean;
|
|
5
5
|
const index_1 = require("../../type/keyof/index");
|
|
6
6
|
const index_2 = require("../check/index");
|
|
7
7
|
const index_3 = require("../clone/index");
|
|
@@ -140,4 +140,3 @@ function Visit(schema, references, value) {
|
|
|
140
140
|
function Clean(...args) {
|
|
141
141
|
return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]);
|
|
142
142
|
}
|
|
143
|
-
exports.Clean = Clean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Clone =
|
|
4
|
+
exports.Clone = Clone;
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
6
|
// ValueGuard
|
|
7
7
|
// ------------------------------------------------------------------
|
|
@@ -48,4 +48,3 @@ function Clone(value) {
|
|
|
48
48
|
return ValueType(value);
|
|
49
49
|
throw new Error('ValueClone: Unable to clone value');
|
|
50
50
|
}
|
|
51
|
-
exports.Clone = Clone;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Convert =
|
|
4
|
+
exports.Convert = Convert;
|
|
5
5
|
const index_1 = require("../clone/index");
|
|
6
6
|
const index_2 = require("../check/index");
|
|
7
7
|
const index_3 = require("../deref/index");
|
|
@@ -249,4 +249,3 @@ function Convert(...args) {
|
|
|
249
249
|
? Visit(args[0], args[1], args[2])
|
|
250
250
|
: Visit(args[0], [], args[1]);
|
|
251
251
|
}
|
|
252
|
-
exports.Convert = Convert;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ValueCreateError = void 0;
|
|
5
|
+
exports.Create = Create;
|
|
5
6
|
const index_1 = require("../guard/index");
|
|
6
7
|
const index_2 = require("../check/index");
|
|
7
8
|
const index_3 = require("../clone/index");
|
|
@@ -467,4 +468,3 @@ function Create(...args) {
|
|
|
467
468
|
recursiveDepth = 0;
|
|
468
469
|
return args.length === 2 ? Visit(args[0], args[1]) : Visit(args[0], []);
|
|
469
470
|
}
|
|
470
|
-
exports.Create = Create;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Default =
|
|
4
|
+
exports.Default = Default;
|
|
5
5
|
const index_1 = require("../check/index");
|
|
6
6
|
const index_2 = require("../clone/index");
|
|
7
7
|
const index_3 = require("../deref/index");
|
|
@@ -153,4 +153,3 @@ function Visit(schema, references, value) {
|
|
|
153
153
|
function Default(...args) {
|
|
154
154
|
return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]);
|
|
155
155
|
}
|
|
156
|
-
exports.Default = Default;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ValueDeltaSymbolError = exports.ValueDeltaError = exports.Edit = exports.Delete = exports.Update = exports.Insert = void 0;
|
|
5
|
+
exports.Diff = Diff;
|
|
6
|
+
exports.Patch = Patch;
|
|
5
7
|
const index_1 = require("../guard/index");
|
|
6
8
|
const index_2 = require("../pointer/index");
|
|
7
9
|
const index_3 = require("../clone/index");
|
|
@@ -135,7 +137,6 @@ function* Visit(path, current, next) {
|
|
|
135
137
|
function Diff(current, next) {
|
|
136
138
|
return [...Visit('', current, next)];
|
|
137
139
|
}
|
|
138
|
-
exports.Diff = Diff;
|
|
139
140
|
// ------------------------------------------------------------------
|
|
140
141
|
// Patch
|
|
141
142
|
// ------------------------------------------------------------------
|
|
@@ -171,4 +172,3 @@ function Patch(current, edits) {
|
|
|
171
172
|
}
|
|
172
173
|
return clone;
|
|
173
174
|
}
|
|
174
|
-
exports.Patch = Patch;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.TypeDereferenceError = void 0;
|
|
5
|
+
exports.Deref = Deref;
|
|
5
6
|
const index_1 = require("../../type/error/index");
|
|
6
7
|
const index_2 = require("../../type/symbols/index");
|
|
7
8
|
class TypeDereferenceError extends index_1.TypeBoxError {
|
|
@@ -24,4 +25,3 @@ function Deref(schema, references) {
|
|
|
24
25
|
? Resolve(schema, references)
|
|
25
26
|
: schema;
|
|
26
27
|
}
|
|
27
|
-
exports.Deref = Deref;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Equal =
|
|
4
|
+
exports.Equal = Equal;
|
|
5
5
|
const index_1 = require("../guard/index");
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Equality Checks
|
|
@@ -48,4 +48,3 @@ function Equal(left, right) {
|
|
|
48
48
|
return ValueType(left, right);
|
|
49
49
|
throw new Error('ValueEquals: Unable to compare value');
|
|
50
50
|
}
|
|
51
|
-
exports.Equal = Equal;
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.IsAsyncIterator = IsAsyncIterator;
|
|
5
|
+
exports.IsIterator = IsIterator;
|
|
6
|
+
exports.IsStandardObject = IsStandardObject;
|
|
7
|
+
exports.IsInstanceObject = IsInstanceObject;
|
|
8
|
+
exports.IsPromise = IsPromise;
|
|
9
|
+
exports.IsDate = IsDate;
|
|
10
|
+
exports.IsMap = IsMap;
|
|
11
|
+
exports.IsSet = IsSet;
|
|
12
|
+
exports.IsRegExp = IsRegExp;
|
|
13
|
+
exports.IsTypedArray = IsTypedArray;
|
|
14
|
+
exports.IsInt8Array = IsInt8Array;
|
|
15
|
+
exports.IsUint8Array = IsUint8Array;
|
|
16
|
+
exports.IsUint8ClampedArray = IsUint8ClampedArray;
|
|
17
|
+
exports.IsInt16Array = IsInt16Array;
|
|
18
|
+
exports.IsUint16Array = IsUint16Array;
|
|
19
|
+
exports.IsInt32Array = IsInt32Array;
|
|
20
|
+
exports.IsUint32Array = IsUint32Array;
|
|
21
|
+
exports.IsFloat32Array = IsFloat32Array;
|
|
22
|
+
exports.IsFloat64Array = IsFloat64Array;
|
|
23
|
+
exports.IsBigInt64Array = IsBigInt64Array;
|
|
24
|
+
exports.IsBigUint64Array = IsBigUint64Array;
|
|
25
|
+
exports.HasPropertyKey = HasPropertyKey;
|
|
26
|
+
exports.IsObject = IsObject;
|
|
27
|
+
exports.IsArray = IsArray;
|
|
28
|
+
exports.IsUndefined = IsUndefined;
|
|
29
|
+
exports.IsNull = IsNull;
|
|
30
|
+
exports.IsBoolean = IsBoolean;
|
|
31
|
+
exports.IsNumber = IsNumber;
|
|
32
|
+
exports.IsInteger = IsInteger;
|
|
33
|
+
exports.IsBigInt = IsBigInt;
|
|
34
|
+
exports.IsString = IsString;
|
|
35
|
+
exports.IsFunction = IsFunction;
|
|
36
|
+
exports.IsSymbol = IsSymbol;
|
|
37
|
+
exports.IsValueType = IsValueType;
|
|
5
38
|
// --------------------------------------------------------------------------
|
|
6
39
|
// Iterators
|
|
7
40
|
// --------------------------------------------------------------------------
|
|
@@ -9,12 +42,10 @@ exports.IsValueType = exports.IsSymbol = exports.IsFunction = exports.IsString =
|
|
|
9
42
|
function IsAsyncIterator(value) {
|
|
10
43
|
return IsObject(value) && Symbol.asyncIterator in value;
|
|
11
44
|
}
|
|
12
|
-
exports.IsAsyncIterator = IsAsyncIterator;
|
|
13
45
|
/** Returns true if this value is an iterator */
|
|
14
46
|
function IsIterator(value) {
|
|
15
47
|
return IsObject(value) && Symbol.iterator in value;
|
|
16
48
|
}
|
|
17
|
-
exports.IsIterator = IsIterator;
|
|
18
49
|
// --------------------------------------------------------------------------
|
|
19
50
|
// Object Instances
|
|
20
51
|
// --------------------------------------------------------------------------
|
|
@@ -22,12 +53,10 @@ exports.IsIterator = IsIterator;
|
|
|
22
53
|
function IsStandardObject(value) {
|
|
23
54
|
return IsObject(value) && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
24
55
|
}
|
|
25
|
-
exports.IsStandardObject = IsStandardObject;
|
|
26
56
|
/** Returns true if this value is an instance of a class */
|
|
27
57
|
function IsInstanceObject(value) {
|
|
28
58
|
return IsObject(value) && !IsArray(value) && IsFunction(value.constructor) && value.constructor.name !== 'Object';
|
|
29
59
|
}
|
|
30
|
-
exports.IsInstanceObject = IsInstanceObject;
|
|
31
60
|
// --------------------------------------------------------------------------
|
|
32
61
|
// JavaScript
|
|
33
62
|
// --------------------------------------------------------------------------
|
|
@@ -35,87 +64,70 @@ exports.IsInstanceObject = IsInstanceObject;
|
|
|
35
64
|
function IsPromise(value) {
|
|
36
65
|
return value instanceof Promise;
|
|
37
66
|
}
|
|
38
|
-
exports.IsPromise = IsPromise;
|
|
39
67
|
/** Returns true if this value is a Date */
|
|
40
68
|
function IsDate(value) {
|
|
41
69
|
return value instanceof Date && Number.isFinite(value.getTime());
|
|
42
70
|
}
|
|
43
|
-
exports.IsDate = IsDate;
|
|
44
71
|
/** Returns true if this value is an instance of Map<K, T> */
|
|
45
72
|
function IsMap(value) {
|
|
46
73
|
return value instanceof globalThis.Map;
|
|
47
74
|
}
|
|
48
|
-
exports.IsMap = IsMap;
|
|
49
75
|
/** Returns true if this value is an instance of Set<T> */
|
|
50
76
|
function IsSet(value) {
|
|
51
77
|
return value instanceof globalThis.Set;
|
|
52
78
|
}
|
|
53
|
-
exports.IsSet = IsSet;
|
|
54
79
|
/** Returns true if this value is RegExp */
|
|
55
80
|
function IsRegExp(value) {
|
|
56
81
|
return value instanceof globalThis.RegExp;
|
|
57
82
|
}
|
|
58
|
-
exports.IsRegExp = IsRegExp;
|
|
59
83
|
/** Returns true if this value is a typed array */
|
|
60
84
|
function IsTypedArray(value) {
|
|
61
85
|
return ArrayBuffer.isView(value);
|
|
62
86
|
}
|
|
63
|
-
exports.IsTypedArray = IsTypedArray;
|
|
64
87
|
/** Returns true if the value is a Int8Array */
|
|
65
88
|
function IsInt8Array(value) {
|
|
66
89
|
return value instanceof globalThis.Int8Array;
|
|
67
90
|
}
|
|
68
|
-
exports.IsInt8Array = IsInt8Array;
|
|
69
91
|
/** Returns true if the value is a Uint8Array */
|
|
70
92
|
function IsUint8Array(value) {
|
|
71
93
|
return value instanceof globalThis.Uint8Array;
|
|
72
94
|
}
|
|
73
|
-
exports.IsUint8Array = IsUint8Array;
|
|
74
95
|
/** Returns true if the value is a Uint8ClampedArray */
|
|
75
96
|
function IsUint8ClampedArray(value) {
|
|
76
97
|
return value instanceof globalThis.Uint8ClampedArray;
|
|
77
98
|
}
|
|
78
|
-
exports.IsUint8ClampedArray = IsUint8ClampedArray;
|
|
79
99
|
/** Returns true if the value is a Int16Array */
|
|
80
100
|
function IsInt16Array(value) {
|
|
81
101
|
return value instanceof globalThis.Int16Array;
|
|
82
102
|
}
|
|
83
|
-
exports.IsInt16Array = IsInt16Array;
|
|
84
103
|
/** Returns true if the value is a Uint16Array */
|
|
85
104
|
function IsUint16Array(value) {
|
|
86
105
|
return value instanceof globalThis.Uint16Array;
|
|
87
106
|
}
|
|
88
|
-
exports.IsUint16Array = IsUint16Array;
|
|
89
107
|
/** Returns true if the value is a Int32Array */
|
|
90
108
|
function IsInt32Array(value) {
|
|
91
109
|
return value instanceof globalThis.Int32Array;
|
|
92
110
|
}
|
|
93
|
-
exports.IsInt32Array = IsInt32Array;
|
|
94
111
|
/** Returns true if the value is a Uint32Array */
|
|
95
112
|
function IsUint32Array(value) {
|
|
96
113
|
return value instanceof globalThis.Uint32Array;
|
|
97
114
|
}
|
|
98
|
-
exports.IsUint32Array = IsUint32Array;
|
|
99
115
|
/** Returns true if the value is a Float32Array */
|
|
100
116
|
function IsFloat32Array(value) {
|
|
101
117
|
return value instanceof globalThis.Float32Array;
|
|
102
118
|
}
|
|
103
|
-
exports.IsFloat32Array = IsFloat32Array;
|
|
104
119
|
/** Returns true if the value is a Float64Array */
|
|
105
120
|
function IsFloat64Array(value) {
|
|
106
121
|
return value instanceof globalThis.Float64Array;
|
|
107
122
|
}
|
|
108
|
-
exports.IsFloat64Array = IsFloat64Array;
|
|
109
123
|
/** Returns true if the value is a BigInt64Array */
|
|
110
124
|
function IsBigInt64Array(value) {
|
|
111
125
|
return value instanceof globalThis.BigInt64Array;
|
|
112
126
|
}
|
|
113
|
-
exports.IsBigInt64Array = IsBigInt64Array;
|
|
114
127
|
/** Returns true if the value is a BigUint64Array */
|
|
115
128
|
function IsBigUint64Array(value) {
|
|
116
129
|
return value instanceof globalThis.BigUint64Array;
|
|
117
130
|
}
|
|
118
|
-
exports.IsBigUint64Array = IsBigUint64Array;
|
|
119
131
|
// --------------------------------------------------------------------------
|
|
120
132
|
// Standard
|
|
121
133
|
// --------------------------------------------------------------------------
|
|
@@ -123,62 +135,50 @@ exports.IsBigUint64Array = IsBigUint64Array;
|
|
|
123
135
|
function HasPropertyKey(value, key) {
|
|
124
136
|
return key in value;
|
|
125
137
|
}
|
|
126
|
-
exports.HasPropertyKey = HasPropertyKey;
|
|
127
138
|
/** Returns true of this value is an object type */
|
|
128
139
|
function IsObject(value) {
|
|
129
140
|
return value !== null && typeof value === 'object';
|
|
130
141
|
}
|
|
131
|
-
exports.IsObject = IsObject;
|
|
132
142
|
/** Returns true if this value is an array, but not a typed array */
|
|
133
143
|
function IsArray(value) {
|
|
134
144
|
return Array.isArray(value) && !ArrayBuffer.isView(value);
|
|
135
145
|
}
|
|
136
|
-
exports.IsArray = IsArray;
|
|
137
146
|
/** Returns true if this value is an undefined */
|
|
138
147
|
function IsUndefined(value) {
|
|
139
148
|
return value === undefined;
|
|
140
149
|
}
|
|
141
|
-
exports.IsUndefined = IsUndefined;
|
|
142
150
|
/** Returns true if this value is an null */
|
|
143
151
|
function IsNull(value) {
|
|
144
152
|
return value === null;
|
|
145
153
|
}
|
|
146
|
-
exports.IsNull = IsNull;
|
|
147
154
|
/** Returns true if this value is an boolean */
|
|
148
155
|
function IsBoolean(value) {
|
|
149
156
|
return typeof value === 'boolean';
|
|
150
157
|
}
|
|
151
|
-
exports.IsBoolean = IsBoolean;
|
|
152
158
|
/** Returns true if this value is an number */
|
|
153
159
|
function IsNumber(value) {
|
|
154
160
|
return typeof value === 'number';
|
|
155
161
|
}
|
|
156
|
-
exports.IsNumber = IsNumber;
|
|
157
162
|
/** Returns true if this value is an integer */
|
|
158
163
|
function IsInteger(value) {
|
|
159
164
|
return Number.isInteger(value);
|
|
160
165
|
}
|
|
161
|
-
exports.IsInteger = IsInteger;
|
|
162
166
|
/** Returns true if this value is bigint */
|
|
163
167
|
function IsBigInt(value) {
|
|
164
168
|
return typeof value === 'bigint';
|
|
165
169
|
}
|
|
166
|
-
exports.IsBigInt = IsBigInt;
|
|
167
170
|
/** Returns true if this value is string */
|
|
168
171
|
function IsString(value) {
|
|
169
172
|
return typeof value === 'string';
|
|
170
173
|
}
|
|
171
|
-
exports.IsString = IsString;
|
|
172
174
|
/** Returns true if this value is a function */
|
|
173
175
|
function IsFunction(value) {
|
|
174
176
|
return typeof value === 'function';
|
|
175
177
|
}
|
|
176
|
-
exports.IsFunction = IsFunction;
|
|
177
178
|
/** Returns true if this value is a symbol */
|
|
178
179
|
function IsSymbol(value) {
|
|
179
180
|
return typeof value === 'symbol';
|
|
180
181
|
}
|
|
181
|
-
exports.IsSymbol = IsSymbol;
|
|
182
182
|
/** Returns true if this value is a value type such as number, string, boolean */
|
|
183
183
|
function IsValueType(value) {
|
|
184
184
|
// prettier-ignore
|
|
@@ -190,4 +190,3 @@ function IsValueType(value) {
|
|
|
190
190
|
IsSymbol(value) ||
|
|
191
191
|
IsUndefined(value));
|
|
192
192
|
}
|
|
193
|
-
exports.IsValueType = IsValueType;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ValueHashError = void 0;
|
|
5
|
+
exports.Hash = Hash;
|
|
5
6
|
const index_1 = require("../guard/index");
|
|
6
7
|
const index_2 = require("../../type/error/index");
|
|
7
8
|
// ------------------------------------------------------------------
|
|
@@ -149,4 +150,3 @@ function Hash(value) {
|
|
|
149
150
|
Visit(value);
|
|
150
151
|
return Accumulator;
|
|
151
152
|
}
|
|
152
|
-
exports.Hash = Hash;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ValueMutateError = void 0;
|
|
5
|
+
exports.Mutate = Mutate;
|
|
5
6
|
const index_1 = require("../guard/index");
|
|
6
7
|
const index_2 = require("../pointer/index");
|
|
7
8
|
const index_3 = require("../clone/index");
|
|
@@ -95,4 +96,3 @@ function Mutate(current, next) {
|
|
|
95
96
|
throw new ValueMutateError('Cannot assign due type mismatch of assignable values');
|
|
96
97
|
Visit(current, '', current, next);
|
|
97
98
|
}
|
|
98
|
-
exports.Mutate = Mutate;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.ValuePointerRootDeleteError = exports.ValuePointerRootSetError = void 0;
|
|
5
|
+
exports.Format = Format;
|
|
6
|
+
exports.Set = Set;
|
|
7
|
+
exports.Delete = Delete;
|
|
8
|
+
exports.Has = Has;
|
|
9
|
+
exports.Get = Get;
|
|
5
10
|
const index_1 = require("../../type/error/index");
|
|
6
11
|
// ------------------------------------------------------------------
|
|
7
12
|
// Errors
|
|
@@ -55,7 +60,6 @@ function* Format(pointer) {
|
|
|
55
60
|
}
|
|
56
61
|
yield Escape(pointer.slice(start));
|
|
57
62
|
}
|
|
58
|
-
exports.Format = Format;
|
|
59
63
|
/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */
|
|
60
64
|
// prettier-ignore
|
|
61
65
|
function Set(value, pointer, update) {
|
|
@@ -71,7 +75,6 @@ function Set(value, pointer, update) {
|
|
|
71
75
|
}
|
|
72
76
|
owner[key] = update;
|
|
73
77
|
}
|
|
74
|
-
exports.Set = Set;
|
|
75
78
|
/** Deletes a value at the given pointer */
|
|
76
79
|
// prettier-ignore
|
|
77
80
|
function Delete(value, pointer) {
|
|
@@ -93,7 +96,6 @@ function Delete(value, pointer) {
|
|
|
93
96
|
delete owner[key];
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
|
-
exports.Delete = Delete;
|
|
97
99
|
/** Returns true if a value exists at the given pointer */
|
|
98
100
|
// prettier-ignore
|
|
99
101
|
function Has(value, pointer) {
|
|
@@ -109,7 +111,6 @@ function Has(value, pointer) {
|
|
|
109
111
|
}
|
|
110
112
|
return Object.getOwnPropertyNames(owner).includes(key);
|
|
111
113
|
}
|
|
112
|
-
exports.Has = Has;
|
|
113
114
|
/** Gets the value at the given pointer */
|
|
114
115
|
// prettier-ignore
|
|
115
116
|
function Get(value, pointer) {
|
|
@@ -123,4 +124,3 @@ function Get(value, pointer) {
|
|
|
123
124
|
}
|
|
124
125
|
return current;
|
|
125
126
|
}
|
|
126
|
-
exports.Get = Get;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.TransformDecodeError = exports.TransformDecodeCheckError = void 0;
|
|
5
|
+
exports.TransformDecode = TransformDecode;
|
|
5
6
|
const index_1 = require("../../type/symbols/index");
|
|
6
7
|
const index_2 = require("../../type/error/index");
|
|
7
8
|
const index_3 = require("../../type/keyof/index");
|
|
@@ -193,4 +194,3 @@ function Visit(schema, references, path, value) {
|
|
|
193
194
|
function TransformDecode(schema, references, value) {
|
|
194
195
|
return Visit(schema, references, '', value);
|
|
195
196
|
}
|
|
196
|
-
exports.TransformDecode = TransformDecode;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.TransformEncodeError = exports.TransformEncodeCheckError = void 0;
|
|
5
|
+
exports.TransformEncode = TransformEncode;
|
|
5
6
|
const index_1 = require("../../type/symbols/index");
|
|
6
7
|
const index_2 = require("../../type/error/index");
|
|
7
8
|
const index_3 = require("../../type/keyof/index");
|
|
@@ -204,4 +205,3 @@ function Visit(schema, references, path, value) {
|
|
|
204
205
|
function TransformEncode(schema, references, value) {
|
|
205
206
|
return Visit(schema, references, '', value);
|
|
206
207
|
}
|
|
207
|
-
exports.TransformEncode = TransformEncode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.HasTransform =
|
|
4
|
+
exports.HasTransform = HasTransform;
|
|
5
5
|
const index_1 = require("../deref/index");
|
|
6
6
|
const index_2 = require("../../type/symbols/index");
|
|
7
7
|
// ------------------------------------------------------------------
|
|
@@ -123,4 +123,3 @@ function HasTransform(schema, references) {
|
|
|
123
123
|
visited.clear();
|
|
124
124
|
return Visit(schema, references);
|
|
125
125
|
}
|
|
126
|
-
exports.HasTransform = HasTransform;
|