@sinclair/typebox 0.32.13 → 0.32.15
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/import/compiler/index.d.mts +1 -1
- package/build/import/compiler/index.mjs +1 -1
- package/build/import/errors/index.d.mts +2 -2
- package/build/import/errors/index.mjs +2 -2
- package/build/import/index.d.mts +69 -69
- package/build/import/index.mjs +69 -76
- package/build/import/system/index.d.mts +2 -2
- package/build/import/system/index.mjs +2 -2
- package/build/import/type/clone/index.d.mts +2 -2
- package/build/import/type/clone/index.mjs +2 -2
- package/build/import/type/const/const.mjs +2 -2
- package/build/import/type/object/object.d.mts +1 -1
- package/build/import/type/object/object.mjs +1 -1
- package/build/import/value/cast/cast.mjs +2 -2
- package/build/import/value/clone/clone.mjs +2 -2
- package/build/import/value/delta/delta.mjs +3 -3
- package/build/import/value/equal/equal.mjs +3 -3
- package/build/import/value/guard/guard.d.mts +34 -6
- package/build/import/value/guard/guard.mjs +71 -12
- package/build/import/value/hash/hash.mjs +2 -2
- package/build/import/value/index.d.mts +14 -14
- package/build/import/value/index.mjs +18 -18
- package/build/import/value/mutate/mutate.mjs +5 -5
- package/build/import/value/transform/decode.mjs +4 -4
- package/build/import/value/transform/encode.mjs +4 -4
- package/build/require/compiler/index.d.ts +1 -1
- package/build/require/compiler/index.js +16 -6
- package/build/require/errors/index.d.ts +2 -2
- package/build/require/errors/index.js +16 -10
- package/build/require/index.d.ts +69 -69
- package/build/require/index.js +83 -202
- package/build/require/system/index.d.ts +2 -2
- package/build/require/system/index.js +16 -7
- package/build/require/type/clone/index.d.ts +2 -2
- package/build/require/type/clone/index.js +16 -3
- package/build/require/type/const/const.js +1 -1
- package/build/require/type/object/object.d.ts +1 -1
- package/build/require/type/object/object.js +1 -2
- package/build/require/value/cast/cast.js +1 -1
- package/build/require/value/clone/clone.js +1 -1
- package/build/require/value/delta/delta.js +2 -2
- package/build/require/value/equal/equal.js +2 -2
- package/build/require/value/guard/guard.d.ts +34 -6
- package/build/require/value/guard/guard.js +89 -16
- package/build/require/value/hash/hash.js +1 -1
- package/build/require/value/index.d.ts +14 -14
- package/build/require/value/index.js +35 -71
- package/build/require/value/mutate/mutate.js +4 -4
- package/build/require/value/transform/decode.js +3 -3
- package/build/require/value/transform/encode.js +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.IsValueType = exports.IsSymbol = exports.IsFunction = exports.IsString = exports.IsBigInt = exports.IsInteger = exports.IsNumber = exports.IsBoolean = exports.IsNull = exports.IsUndefined = exports.IsArray = exports.IsObject = exports.
|
|
4
|
+
exports.IsValueType = exports.IsSymbol = exports.IsFunction = exports.IsString = exports.IsBigInt = exports.IsInteger = exports.IsNumber = exports.IsBoolean = exports.IsNull = exports.IsUndefined = exports.IsArray = exports.IsObject = exports.HasPropertyKey = exports.IsBigUint64Array = exports.IsBigInt64Array = exports.IsFloat64Array = exports.IsFloat32Array = exports.IsUint32Array = exports.IsInt32Array = exports.IsUint16Array = exports.IsInt16Array = exports.IsUint8ClampedArray = exports.IsUint8Array = exports.IsInt8Array = exports.IsTypedArray = exports.IsRegExp = exports.IsSet = exports.IsMap = exports.IsDate = exports.IsPromise = exports.IsInstanceObject = exports.IsStandardObject = exports.IsIterator = exports.IsAsyncIterator = void 0;
|
|
5
5
|
// --------------------------------------------------------------------------
|
|
6
6
|
// Iterators
|
|
7
7
|
// --------------------------------------------------------------------------
|
|
@@ -16,28 +16,106 @@ function IsIterator(value) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.IsIterator = IsIterator;
|
|
18
18
|
// --------------------------------------------------------------------------
|
|
19
|
-
//
|
|
19
|
+
// Object Instances
|
|
20
20
|
// --------------------------------------------------------------------------
|
|
21
|
-
/** Returns true if this value is a
|
|
22
|
-
function
|
|
23
|
-
return
|
|
21
|
+
/** Returns true if this value is not an instance of a class */
|
|
22
|
+
function IsStandardObject(value) {
|
|
23
|
+
return IsObject(value) && !IsArray(value) && IsFunction(value.constructor) && value.constructor.name === 'Object';
|
|
24
24
|
}
|
|
25
|
-
exports.
|
|
25
|
+
exports.IsStandardObject = IsStandardObject;
|
|
26
|
+
/** Returns true if this value is an instance of a class */
|
|
27
|
+
function IsInstanceObject(value) {
|
|
28
|
+
return IsObject(value) && !IsArray(value) && IsFunction(value.constructor) && value.constructor.name !== 'Object';
|
|
29
|
+
}
|
|
30
|
+
exports.IsInstanceObject = IsInstanceObject;
|
|
31
|
+
// --------------------------------------------------------------------------
|
|
32
|
+
// JavaScript
|
|
33
|
+
// --------------------------------------------------------------------------
|
|
26
34
|
/** Returns true if this value is a Promise */
|
|
27
35
|
function IsPromise(value) {
|
|
28
36
|
return value instanceof Promise;
|
|
29
37
|
}
|
|
30
38
|
exports.IsPromise = IsPromise;
|
|
31
|
-
/** Returns true if the value is a Uint8Array */
|
|
32
|
-
function IsUint8Array(value) {
|
|
33
|
-
return value instanceof Uint8Array;
|
|
34
|
-
}
|
|
35
|
-
exports.IsUint8Array = IsUint8Array;
|
|
36
39
|
/** Returns true if this value is a Date */
|
|
37
40
|
function IsDate(value) {
|
|
38
41
|
return value instanceof Date && Number.isFinite(value.getTime());
|
|
39
42
|
}
|
|
40
43
|
exports.IsDate = IsDate;
|
|
44
|
+
/** Returns true if this value is an instance of Map<K, T> */
|
|
45
|
+
function IsMap(value) {
|
|
46
|
+
return value instanceof globalThis.Map;
|
|
47
|
+
}
|
|
48
|
+
exports.IsMap = IsMap;
|
|
49
|
+
/** Returns true if this value is an instance of Set<T> */
|
|
50
|
+
function IsSet(value) {
|
|
51
|
+
return value instanceof globalThis.Set;
|
|
52
|
+
}
|
|
53
|
+
exports.IsSet = IsSet;
|
|
54
|
+
/** Returns true if this value is RegExp */
|
|
55
|
+
function IsRegExp(value) {
|
|
56
|
+
return value instanceof globalThis.RegExp;
|
|
57
|
+
}
|
|
58
|
+
exports.IsRegExp = IsRegExp;
|
|
59
|
+
/** Returns true if this value is a typed array */
|
|
60
|
+
function IsTypedArray(value) {
|
|
61
|
+
return ArrayBuffer.isView(value);
|
|
62
|
+
}
|
|
63
|
+
exports.IsTypedArray = IsTypedArray;
|
|
64
|
+
/** Returns true if the value is a Int8Array */
|
|
65
|
+
function IsInt8Array(value) {
|
|
66
|
+
return value instanceof globalThis.Int8Array;
|
|
67
|
+
}
|
|
68
|
+
exports.IsInt8Array = IsInt8Array;
|
|
69
|
+
/** Returns true if the value is a Uint8Array */
|
|
70
|
+
function IsUint8Array(value) {
|
|
71
|
+
return value instanceof globalThis.Uint8Array;
|
|
72
|
+
}
|
|
73
|
+
exports.IsUint8Array = IsUint8Array;
|
|
74
|
+
/** Returns true if the value is a Uint8ClampedArray */
|
|
75
|
+
function IsUint8ClampedArray(value) {
|
|
76
|
+
return value instanceof globalThis.Uint8ClampedArray;
|
|
77
|
+
}
|
|
78
|
+
exports.IsUint8ClampedArray = IsUint8ClampedArray;
|
|
79
|
+
/** Returns true if the value is a Int16Array */
|
|
80
|
+
function IsInt16Array(value) {
|
|
81
|
+
return value instanceof globalThis.Int16Array;
|
|
82
|
+
}
|
|
83
|
+
exports.IsInt16Array = IsInt16Array;
|
|
84
|
+
/** Returns true if the value is a Uint16Array */
|
|
85
|
+
function IsUint16Array(value) {
|
|
86
|
+
return value instanceof globalThis.Uint16Array;
|
|
87
|
+
}
|
|
88
|
+
exports.IsUint16Array = IsUint16Array;
|
|
89
|
+
/** Returns true if the value is a Int32Array */
|
|
90
|
+
function IsInt32Array(value) {
|
|
91
|
+
return value instanceof globalThis.Int32Array;
|
|
92
|
+
}
|
|
93
|
+
exports.IsInt32Array = IsInt32Array;
|
|
94
|
+
/** Returns true if the value is a Uint32Array */
|
|
95
|
+
function IsUint32Array(value) {
|
|
96
|
+
return value instanceof globalThis.Uint32Array;
|
|
97
|
+
}
|
|
98
|
+
exports.IsUint32Array = IsUint32Array;
|
|
99
|
+
/** Returns true if the value is a Float32Array */
|
|
100
|
+
function IsFloat32Array(value) {
|
|
101
|
+
return value instanceof globalThis.Float32Array;
|
|
102
|
+
}
|
|
103
|
+
exports.IsFloat32Array = IsFloat32Array;
|
|
104
|
+
/** Returns true if the value is a Float64Array */
|
|
105
|
+
function IsFloat64Array(value) {
|
|
106
|
+
return value instanceof globalThis.Float64Array;
|
|
107
|
+
}
|
|
108
|
+
exports.IsFloat64Array = IsFloat64Array;
|
|
109
|
+
/** Returns true if the value is a BigInt64Array */
|
|
110
|
+
function IsBigInt64Array(value) {
|
|
111
|
+
return value instanceof globalThis.BigInt64Array;
|
|
112
|
+
}
|
|
113
|
+
exports.IsBigInt64Array = IsBigInt64Array;
|
|
114
|
+
/** Returns true if the value is a BigUint64Array */
|
|
115
|
+
function IsBigUint64Array(value) {
|
|
116
|
+
return value instanceof globalThis.BigUint64Array;
|
|
117
|
+
}
|
|
118
|
+
exports.IsBigUint64Array = IsBigUint64Array;
|
|
41
119
|
// --------------------------------------------------------------------------
|
|
42
120
|
// Standard
|
|
43
121
|
// --------------------------------------------------------------------------
|
|
@@ -46,11 +124,6 @@ function HasPropertyKey(value, key) {
|
|
|
46
124
|
return key in value;
|
|
47
125
|
}
|
|
48
126
|
exports.HasPropertyKey = HasPropertyKey;
|
|
49
|
-
/** Returns true if this object is not an instance of any other type */
|
|
50
|
-
function IsPlainObject(value) {
|
|
51
|
-
return IsObject(value) && IsFunction(value.constructor) && value.constructor.name === 'Object';
|
|
52
|
-
}
|
|
53
|
-
exports.IsPlainObject = IsPlainObject;
|
|
54
127
|
/** Returns true of this value is an object type */
|
|
55
128
|
function IsObject(value) {
|
|
56
129
|
return value !== null && typeof value === 'object';
|
|
@@ -124,7 +124,7 @@ function Visit(value) {
|
|
|
124
124
|
return NullType(value);
|
|
125
125
|
if ((0, index_1.IsNumber)(value))
|
|
126
126
|
return NumberType(value);
|
|
127
|
-
if ((0, index_1.
|
|
127
|
+
if ((0, index_1.IsStandardObject)(value))
|
|
128
128
|
return ObjectType(value);
|
|
129
129
|
if ((0, index_1.IsString)(value))
|
|
130
130
|
return StringType(value);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export { ValueError, ValueErrorType, ValueErrorIterator } from '../errors/index';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
2
|
+
export * from './guard/index';
|
|
3
|
+
export * from './cast/index';
|
|
4
|
+
export * from './check/index';
|
|
5
|
+
export * from './clean/index';
|
|
6
|
+
export * from './clone/index';
|
|
7
|
+
export * from './convert/index';
|
|
8
|
+
export * from './create/index';
|
|
9
|
+
export * from './default/index';
|
|
10
|
+
export * from './delta/index';
|
|
11
|
+
export * from './equal/index';
|
|
12
|
+
export * from './hash/index';
|
|
13
|
+
export * from './mutate/index';
|
|
14
|
+
export * from './pointer/index';
|
|
15
|
+
export * from './transform/index';
|
|
16
16
|
export { Value } from './value/index';
|
|
@@ -1,85 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
3
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.Value = exports.IsValueType = void 0;
|
|
18
|
+
exports.Value = exports.ValueErrorIterator = exports.ValueErrorType = void 0;
|
|
6
19
|
// ------------------------------------------------------------------
|
|
7
|
-
//
|
|
20
|
+
// Errors (re-export)
|
|
8
21
|
// ------------------------------------------------------------------
|
|
9
22
|
var index_1 = require("../errors/index");
|
|
10
23
|
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } });
|
|
11
24
|
Object.defineProperty(exports, "ValueErrorIterator", { enumerable: true, get: function () { return index_1.ValueErrorIterator; } });
|
|
12
25
|
// ------------------------------------------------------------------
|
|
13
|
-
//
|
|
26
|
+
// Guards
|
|
14
27
|
// ------------------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(exports, "Cast", { enumerable: true, get: function () { return index_2.Cast; } });
|
|
17
|
-
Object.defineProperty(exports, "ValueCastError", { enumerable: true, get: function () { return index_2.ValueCastError; } });
|
|
18
|
-
var index_3 = require("./check/index");
|
|
19
|
-
Object.defineProperty(exports, "Check", { enumerable: true, get: function () { return index_3.Check; } });
|
|
20
|
-
var index_4 = require("./clean/index");
|
|
21
|
-
Object.defineProperty(exports, "Clean", { enumerable: true, get: function () { return index_4.Clean; } });
|
|
22
|
-
var index_5 = require("./clone/index");
|
|
23
|
-
Object.defineProperty(exports, "Clone", { enumerable: true, get: function () { return index_5.Clone; } });
|
|
24
|
-
var index_6 = require("./convert/index");
|
|
25
|
-
Object.defineProperty(exports, "Convert", { enumerable: true, get: function () { return index_6.Convert; } });
|
|
26
|
-
var index_7 = require("./create/index");
|
|
27
|
-
Object.defineProperty(exports, "Create", { enumerable: true, get: function () { return index_7.Create; } });
|
|
28
|
-
Object.defineProperty(exports, "ValueCreateError", { enumerable: true, get: function () { return index_7.ValueCreateError; } });
|
|
29
|
-
var index_8 = require("./default/index");
|
|
30
|
-
Object.defineProperty(exports, "Default", { enumerable: true, get: function () { return index_8.Default; } });
|
|
31
|
-
var index_9 = require("./delta/index");
|
|
32
|
-
Object.defineProperty(exports, "Diff", { enumerable: true, get: function () { return index_9.Diff; } });
|
|
33
|
-
Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return index_9.Patch; } });
|
|
34
|
-
Object.defineProperty(exports, "Edit", { enumerable: true, get: function () { return index_9.Edit; } });
|
|
35
|
-
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return index_9.Delete; } });
|
|
36
|
-
Object.defineProperty(exports, "Insert", { enumerable: true, get: function () { return index_9.Insert; } });
|
|
37
|
-
Object.defineProperty(exports, "Update", { enumerable: true, get: function () { return index_9.Update; } });
|
|
38
|
-
Object.defineProperty(exports, "ValueDeltaError", { enumerable: true, get: function () { return index_9.ValueDeltaError; } });
|
|
39
|
-
var index_10 = require("./equal/index");
|
|
40
|
-
Object.defineProperty(exports, "Equal", { enumerable: true, get: function () { return index_10.Equal; } });
|
|
41
|
-
var index_11 = require("./hash/index");
|
|
42
|
-
Object.defineProperty(exports, "Hash", { enumerable: true, get: function () { return index_11.Hash; } });
|
|
43
|
-
Object.defineProperty(exports, "ValueHashError", { enumerable: true, get: function () { return index_11.ValueHashError; } });
|
|
44
|
-
var index_12 = require("./mutate/index");
|
|
45
|
-
Object.defineProperty(exports, "Mutate", { enumerable: true, get: function () { return index_12.Mutate; } });
|
|
46
|
-
Object.defineProperty(exports, "ValueMutateError", { enumerable: true, get: function () { return index_12.ValueMutateError; } });
|
|
47
|
-
var index_13 = require("./pointer/index");
|
|
48
|
-
Object.defineProperty(exports, "ValuePointer", { enumerable: true, get: function () { return index_13.ValuePointer; } });
|
|
49
|
-
var index_14 = require("./transform/index");
|
|
50
|
-
Object.defineProperty(exports, "TransformDecode", { enumerable: true, get: function () { return index_14.TransformDecode; } });
|
|
51
|
-
Object.defineProperty(exports, "TransformEncode", { enumerable: true, get: function () { return index_14.TransformEncode; } });
|
|
52
|
-
Object.defineProperty(exports, "HasTransform", { enumerable: true, get: function () { return index_14.HasTransform; } });
|
|
53
|
-
Object.defineProperty(exports, "TransformDecodeCheckError", { enumerable: true, get: function () { return index_14.TransformDecodeCheckError; } });
|
|
54
|
-
Object.defineProperty(exports, "TransformDecodeError", { enumerable: true, get: function () { return index_14.TransformDecodeError; } });
|
|
55
|
-
Object.defineProperty(exports, "TransformEncodeCheckError", { enumerable: true, get: function () { return index_14.TransformEncodeCheckError; } });
|
|
56
|
-
Object.defineProperty(exports, "TransformEncodeError", { enumerable: true, get: function () { return index_14.TransformEncodeError; } });
|
|
28
|
+
__exportStar(require("./guard/index"), exports);
|
|
57
29
|
// ------------------------------------------------------------------
|
|
58
|
-
//
|
|
30
|
+
// Operators
|
|
59
31
|
// ------------------------------------------------------------------
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Object.defineProperty(exports, "IsPlainObject", { enumerable: true, get: function () { return index_15.IsPlainObject; } });
|
|
74
|
-
Object.defineProperty(exports, "IsPromise", { enumerable: true, get: function () { return index_15.IsPromise; } });
|
|
75
|
-
Object.defineProperty(exports, "IsString", { enumerable: true, get: function () { return index_15.IsString; } });
|
|
76
|
-
Object.defineProperty(exports, "IsSymbol", { enumerable: true, get: function () { return index_15.IsSymbol; } });
|
|
77
|
-
Object.defineProperty(exports, "IsTypedArray", { enumerable: true, get: function () { return index_15.IsTypedArray; } });
|
|
78
|
-
Object.defineProperty(exports, "IsUint8Array", { enumerable: true, get: function () { return index_15.IsUint8Array; } });
|
|
79
|
-
Object.defineProperty(exports, "IsUndefined", { enumerable: true, get: function () { return index_15.IsUndefined; } });
|
|
80
|
-
Object.defineProperty(exports, "IsValueType", { enumerable: true, get: function () { return index_15.IsValueType; } });
|
|
32
|
+
__exportStar(require("./cast/index"), exports);
|
|
33
|
+
__exportStar(require("./check/index"), exports);
|
|
34
|
+
__exportStar(require("./clean/index"), exports);
|
|
35
|
+
__exportStar(require("./clone/index"), exports);
|
|
36
|
+
__exportStar(require("./convert/index"), exports);
|
|
37
|
+
__exportStar(require("./create/index"), exports);
|
|
38
|
+
__exportStar(require("./default/index"), exports);
|
|
39
|
+
__exportStar(require("./delta/index"), exports);
|
|
40
|
+
__exportStar(require("./equal/index"), exports);
|
|
41
|
+
__exportStar(require("./hash/index"), exports);
|
|
42
|
+
__exportStar(require("./mutate/index"), exports);
|
|
43
|
+
__exportStar(require("./pointer/index"), exports);
|
|
44
|
+
__exportStar(require("./transform/index"), exports);
|
|
81
45
|
// ------------------------------------------------------------------
|
|
82
|
-
//
|
|
46
|
+
// Namespace
|
|
83
47
|
// ------------------------------------------------------------------
|
|
84
|
-
var
|
|
85
|
-
Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return
|
|
48
|
+
var index_2 = require("./value/index");
|
|
49
|
+
Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return index_2.Value; } });
|
|
@@ -16,7 +16,7 @@ class ValueMutateError extends index_4.TypeBoxError {
|
|
|
16
16
|
}
|
|
17
17
|
exports.ValueMutateError = ValueMutateError;
|
|
18
18
|
function ObjectType(root, path, current, next) {
|
|
19
|
-
if (!(0, index_1.
|
|
19
|
+
if (!(0, index_1.IsStandardObject)(current)) {
|
|
20
20
|
index_2.ValuePointer.Set(root, path, (0, index_3.Clone)(next));
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
@@ -68,7 +68,7 @@ function Visit(root, path, current, next) {
|
|
|
68
68
|
return ArrayType(root, path, current, next);
|
|
69
69
|
if ((0, index_1.IsTypedArray)(next))
|
|
70
70
|
return TypedArrayType(root, path, current, next);
|
|
71
|
-
if ((0, index_1.
|
|
71
|
+
if ((0, index_1.IsStandardObject)(next))
|
|
72
72
|
return ObjectType(root, path, current, next);
|
|
73
73
|
if ((0, index_1.IsValueType)(next))
|
|
74
74
|
return ValueType(root, path, current, next);
|
|
@@ -81,8 +81,8 @@ function IsNonMutableValue(value) {
|
|
|
81
81
|
}
|
|
82
82
|
function IsMismatchedValue(current, next) {
|
|
83
83
|
// prettier-ignore
|
|
84
|
-
return (((0, index_1.
|
|
85
|
-
((0, index_1.IsArray)(current) && (0, index_1.
|
|
84
|
+
return (((0, index_1.IsStandardObject)(current) && (0, index_1.IsArray)(next)) ||
|
|
85
|
+
((0, index_1.IsArray)(current) && (0, index_1.IsStandardObject)(next)));
|
|
86
86
|
}
|
|
87
87
|
// ------------------------------------------------------------------
|
|
88
88
|
// Mutate
|
|
@@ -57,7 +57,7 @@ function FromArray(schema, references, value) {
|
|
|
57
57
|
}
|
|
58
58
|
// prettier-ignore
|
|
59
59
|
function FromIntersect(schema, references, value) {
|
|
60
|
-
if (!(0, index_7.
|
|
60
|
+
if (!(0, index_7.IsStandardObject)(value) || (0, index_7.IsValueType)(value))
|
|
61
61
|
return Default(schema, value);
|
|
62
62
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
63
63
|
const knownProperties = knownKeys.reduce((value, key) => {
|
|
@@ -82,7 +82,7 @@ function FromNot(schema, references, value) {
|
|
|
82
82
|
}
|
|
83
83
|
// prettier-ignore
|
|
84
84
|
function FromObject(schema, references, value) {
|
|
85
|
-
if (!(0, index_7.
|
|
85
|
+
if (!(0, index_7.IsStandardObject)(value))
|
|
86
86
|
return Default(schema, value);
|
|
87
87
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
88
88
|
const knownProperties = knownKeys.reduce((value, key) => {
|
|
@@ -104,7 +104,7 @@ function FromObject(schema, references, value) {
|
|
|
104
104
|
}
|
|
105
105
|
// prettier-ignore
|
|
106
106
|
function FromRecord(schema, references, value) {
|
|
107
|
-
if (!(0, index_7.
|
|
107
|
+
if (!(0, index_7.IsStandardObject)(value))
|
|
108
108
|
return Default(schema, value);
|
|
109
109
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
110
110
|
const knownKeys = new RegExp(pattern);
|
|
@@ -58,7 +58,7 @@ function FromArray(schema, references, value) {
|
|
|
58
58
|
// prettier-ignore
|
|
59
59
|
function FromIntersect(schema, references, value) {
|
|
60
60
|
const defaulted = Default(schema, value);
|
|
61
|
-
if (!(0, index_7.
|
|
61
|
+
if (!(0, index_7.IsStandardObject)(value) || (0, index_7.IsValueType)(value))
|
|
62
62
|
return defaulted;
|
|
63
63
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
64
64
|
const knownProperties = knownKeys.reduce((value, key) => {
|
|
@@ -84,7 +84,7 @@ function FromNot(schema, references, value) {
|
|
|
84
84
|
// prettier-ignore
|
|
85
85
|
function FromObject(schema, references, value) {
|
|
86
86
|
const defaulted = Default(schema, value);
|
|
87
|
-
if (!(0, index_7.
|
|
87
|
+
if (!(0, index_7.IsStandardObject)(value))
|
|
88
88
|
return defaulted;
|
|
89
89
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
90
90
|
const knownProperties = knownKeys.reduce((value, key) => {
|
|
@@ -106,7 +106,7 @@ function FromObject(schema, references, value) {
|
|
|
106
106
|
// prettier-ignore
|
|
107
107
|
function FromRecord(schema, references, value) {
|
|
108
108
|
const defaulted = Default(schema, value);
|
|
109
|
-
if (!(0, index_7.
|
|
109
|
+
if (!(0, index_7.IsStandardObject)(value))
|
|
110
110
|
return defaulted;
|
|
111
111
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
112
112
|
const knownKeys = new RegExp(pattern);
|