@sinclair/typebox 0.25.23 → 0.25.25
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/compiler/compiler.d.ts +25 -28
- package/compiler/compiler.js +495 -495
- package/compiler/index.d.ts +2 -2
- package/compiler/index.js +47 -47
- package/conditional/conditional.d.ts +17 -17
- package/conditional/conditional.js +91 -91
- package/conditional/index.d.ts +2 -2
- package/conditional/index.js +45 -45
- package/conditional/structural.d.ts +11 -11
- package/conditional/structural.js +685 -685
- package/custom/custom.d.ts +12 -12
- package/custom/custom.js +55 -55
- package/custom/index.d.ts +1 -1
- package/custom/index.js +44 -44
- package/errors/errors.d.ts +67 -67
- package/errors/errors.js +472 -468
- package/errors/index.d.ts +1 -1
- package/errors/index.js +44 -44
- package/format/format.d.ts +12 -12
- package/format/format.js +55 -55
- package/format/index.d.ts +1 -1
- package/format/index.js +44 -44
- package/guard/extends.d.ts +10 -0
- package/guard/extends.js +50 -0
- package/guard/guard.d.ts +60 -60
- package/guard/guard.js +440 -440
- package/guard/index.d.ts +2 -1
- package/guard/index.js +45 -44
- package/hash/hash.d.ts +8 -8
- package/hash/hash.js +183 -183
- package/hash/index.d.ts +1 -1
- package/hash/index.js +44 -44
- package/license +22 -22
- package/package.json +55 -52
- package/readme.md +1237 -1325
- package/system/index.d.ts +1 -1
- package/system/index.js +44 -44
- package/system/system.d.ts +17 -17
- package/system/system.js +69 -69
- package/typebox.d.ts +422 -422
- package/typebox.js +388 -388
- package/value/cast.d.ts +26 -26
- package/value/cast.js +415 -420
- package/value/check.d.ts +8 -8
- package/value/check.js +405 -395
- package/value/clone.d.ts +3 -3
- package/value/clone.js +71 -71
- package/value/create.d.ts +14 -14
- package/value/create.js +378 -388
- package/value/delta.d.ts +43 -43
- package/value/delta.js +204 -204
- package/value/equal.d.ts +3 -3
- package/value/equal.js +80 -80
- package/value/index.d.ts +4 -4
- package/value/index.js +53 -53
- package/value/is.d.ts +11 -11
- package/value/is.js +53 -53
- package/value/pointer.d.ts +24 -24
- package/value/pointer.js +142 -142
- package/value/value.d.ts +32 -32
- package/value/value.js +87 -87
package/value/equal.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
|
-
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.ValueEqual = void 0;
|
|
31
|
-
const is_1 = require("./is");
|
|
32
|
-
var ValueEqual;
|
|
33
|
-
(function (ValueEqual) {
|
|
34
|
-
function Object(left, right) {
|
|
35
|
-
if (!is_1.Is.Object(right))
|
|
36
|
-
return false;
|
|
37
|
-
const leftKeys = [...globalThis.Object.keys(left), ...globalThis.Object.getOwnPropertySymbols(left)];
|
|
38
|
-
const rightKeys = [...globalThis.Object.keys(right), ...globalThis.Object.getOwnPropertySymbols(right)];
|
|
39
|
-
if (leftKeys.length !== rightKeys.length)
|
|
40
|
-
return false;
|
|
41
|
-
return leftKeys.every((key) => Equal(left[key], right[key]));
|
|
42
|
-
}
|
|
43
|
-
function Date(left, right) {
|
|
44
|
-
return is_1.Is.Date(right) && left.getTime() === right.getTime();
|
|
45
|
-
}
|
|
46
|
-
function Array(left, right) {
|
|
47
|
-
if (!is_1.Is.Array(right) || left.length !== right.length)
|
|
48
|
-
return false;
|
|
49
|
-
return left.every((value, index) => Equal(value, right[index]));
|
|
50
|
-
}
|
|
51
|
-
function TypedArray(left, right) {
|
|
52
|
-
if (!is_1.Is.TypedArray(right) || left.length !== right.length || globalThis.Object.getPrototypeOf(left).constructor.name !== globalThis.Object.getPrototypeOf(right).constructor.name)
|
|
53
|
-
return false;
|
|
54
|
-
return left.every((value, index) => Equal(value, right[index]));
|
|
55
|
-
}
|
|
56
|
-
function Value(left, right) {
|
|
57
|
-
return left === right;
|
|
58
|
-
}
|
|
59
|
-
function Equal(left, right) {
|
|
60
|
-
if (is_1.Is.Object(left)) {
|
|
61
|
-
return Object(left, right);
|
|
62
|
-
}
|
|
63
|
-
else if (is_1.Is.Date(left)) {
|
|
64
|
-
return Date(left, right);
|
|
65
|
-
}
|
|
66
|
-
else if (is_1.Is.TypedArray(left)) {
|
|
67
|
-
return TypedArray(left, right);
|
|
68
|
-
}
|
|
69
|
-
else if (is_1.Is.Array(left)) {
|
|
70
|
-
return Array(left, right);
|
|
71
|
-
}
|
|
72
|
-
else if (is_1.Is.Value(left)) {
|
|
73
|
-
return Value(left, right);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
throw new Error('ValueEquals: Unable to compare value');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
ValueEqual.Equal = Equal;
|
|
80
|
-
})(ValueEqual = exports.ValueEqual || (exports.ValueEqual = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
4
|
+
@sinclair/typebox/value
|
|
5
|
+
|
|
6
|
+
The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
27
|
+
|
|
28
|
+
---------------------------------------------------------------------------*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.ValueEqual = void 0;
|
|
31
|
+
const is_1 = require("./is");
|
|
32
|
+
var ValueEqual;
|
|
33
|
+
(function (ValueEqual) {
|
|
34
|
+
function Object(left, right) {
|
|
35
|
+
if (!is_1.Is.Object(right))
|
|
36
|
+
return false;
|
|
37
|
+
const leftKeys = [...globalThis.Object.keys(left), ...globalThis.Object.getOwnPropertySymbols(left)];
|
|
38
|
+
const rightKeys = [...globalThis.Object.keys(right), ...globalThis.Object.getOwnPropertySymbols(right)];
|
|
39
|
+
if (leftKeys.length !== rightKeys.length)
|
|
40
|
+
return false;
|
|
41
|
+
return leftKeys.every((key) => Equal(left[key], right[key]));
|
|
42
|
+
}
|
|
43
|
+
function Date(left, right) {
|
|
44
|
+
return is_1.Is.Date(right) && left.getTime() === right.getTime();
|
|
45
|
+
}
|
|
46
|
+
function Array(left, right) {
|
|
47
|
+
if (!is_1.Is.Array(right) || left.length !== right.length)
|
|
48
|
+
return false;
|
|
49
|
+
return left.every((value, index) => Equal(value, right[index]));
|
|
50
|
+
}
|
|
51
|
+
function TypedArray(left, right) {
|
|
52
|
+
if (!is_1.Is.TypedArray(right) || left.length !== right.length || globalThis.Object.getPrototypeOf(left).constructor.name !== globalThis.Object.getPrototypeOf(right).constructor.name)
|
|
53
|
+
return false;
|
|
54
|
+
return left.every((value, index) => Equal(value, right[index]));
|
|
55
|
+
}
|
|
56
|
+
function Value(left, right) {
|
|
57
|
+
return left === right;
|
|
58
|
+
}
|
|
59
|
+
function Equal(left, right) {
|
|
60
|
+
if (is_1.Is.Object(left)) {
|
|
61
|
+
return Object(left, right);
|
|
62
|
+
}
|
|
63
|
+
else if (is_1.Is.Date(left)) {
|
|
64
|
+
return Date(left, right);
|
|
65
|
+
}
|
|
66
|
+
else if (is_1.Is.TypedArray(left)) {
|
|
67
|
+
return TypedArray(left, right);
|
|
68
|
+
}
|
|
69
|
+
else if (is_1.Is.Array(left)) {
|
|
70
|
+
return Array(left, right);
|
|
71
|
+
}
|
|
72
|
+
else if (is_1.Is.Value(left)) {
|
|
73
|
+
return Value(left, right);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
throw new Error('ValueEquals: Unable to compare value');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
ValueEqual.Equal = Equal;
|
|
80
|
+
})(ValueEqual = exports.ValueEqual || (exports.ValueEqual = {}));
|
package/value/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ValueError, ValueErrorType } from '../errors/index';
|
|
2
|
-
export { Edit, Insert, Update, Delete } from './delta';
|
|
3
|
-
export * from './pointer';
|
|
4
|
-
export * from './value';
|
|
1
|
+
export { ValueError, ValueErrorType } from '../errors/index';
|
|
2
|
+
export { Edit, Insert, Update, Delete } from './delta';
|
|
3
|
+
export * from './pointer';
|
|
4
|
+
export * from './value';
|
package/value/index.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
|
-
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
|
-
if (k2 === undefined) k2 = k;
|
|
31
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
33
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
34
|
-
}
|
|
35
|
-
Object.defineProperty(o, k2, desc);
|
|
36
|
-
}) : (function(o, m, k, k2) {
|
|
37
|
-
if (k2 === undefined) k2 = k;
|
|
38
|
-
o[k2] = m[k];
|
|
39
|
-
}));
|
|
40
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
41
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.Delete = exports.Update = exports.Insert = exports.Edit = exports.ValueErrorType = void 0;
|
|
45
|
-
var index_1 = require("../errors/index");
|
|
46
|
-
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } });
|
|
47
|
-
var delta_1 = require("./delta");
|
|
48
|
-
Object.defineProperty(exports, "Edit", { enumerable: true, get: function () { return delta_1.Edit; } });
|
|
49
|
-
Object.defineProperty(exports, "Insert", { enumerable: true, get: function () { return delta_1.Insert; } });
|
|
50
|
-
Object.defineProperty(exports, "Update", { enumerable: true, get: function () { return delta_1.Update; } });
|
|
51
|
-
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return delta_1.Delete; } });
|
|
52
|
-
__exportStar(require("./pointer"), exports);
|
|
53
|
-
__exportStar(require("./value"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
4
|
+
@sinclair/typebox/value
|
|
5
|
+
|
|
6
|
+
The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
27
|
+
|
|
28
|
+
---------------------------------------------------------------------------*/
|
|
29
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
33
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(o, k2, desc);
|
|
36
|
+
}) : (function(o, m, k, k2) {
|
|
37
|
+
if (k2 === undefined) k2 = k;
|
|
38
|
+
o[k2] = m[k];
|
|
39
|
+
}));
|
|
40
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
41
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.Delete = exports.Update = exports.Insert = exports.Edit = exports.ValueErrorType = void 0;
|
|
45
|
+
var index_1 = require("../errors/index");
|
|
46
|
+
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } });
|
|
47
|
+
var delta_1 = require("./delta");
|
|
48
|
+
Object.defineProperty(exports, "Edit", { enumerable: true, get: function () { return delta_1.Edit; } });
|
|
49
|
+
Object.defineProperty(exports, "Insert", { enumerable: true, get: function () { return delta_1.Insert; } });
|
|
50
|
+
Object.defineProperty(exports, "Update", { enumerable: true, get: function () { return delta_1.Update; } });
|
|
51
|
+
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return delta_1.Delete; } });
|
|
52
|
+
__exportStar(require("./pointer"), exports);
|
|
53
|
+
__exportStar(require("./value"), exports);
|
package/value/is.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export type ValueType = null | undefined | Function | symbol | bigint | number | boolean | string;
|
|
2
|
-
export type ObjectType = Record<string | number | symbol, unknown>;
|
|
3
|
-
export type TypedArrayType = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
4
|
-
export type ArrayType = unknown[];
|
|
5
|
-
export declare namespace Is {
|
|
6
|
-
function Object(value: unknown): value is ObjectType;
|
|
7
|
-
function Date(value: unknown): value is Date;
|
|
8
|
-
function Array(value: unknown): value is ArrayType;
|
|
9
|
-
function Value(value: unknown): value is ValueType;
|
|
10
|
-
function TypedArray(value: unknown): value is TypedArrayType;
|
|
11
|
-
}
|
|
1
|
+
export type ValueType = null | undefined | Function | symbol | bigint | number | boolean | string;
|
|
2
|
+
export type ObjectType = Record<string | number | symbol, unknown>;
|
|
3
|
+
export type TypedArrayType = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
4
|
+
export type ArrayType = unknown[];
|
|
5
|
+
export declare namespace Is {
|
|
6
|
+
function Object(value: unknown): value is ObjectType;
|
|
7
|
+
function Date(value: unknown): value is Date;
|
|
8
|
+
function Array(value: unknown): value is ArrayType;
|
|
9
|
+
function Value(value: unknown): value is ValueType;
|
|
10
|
+
function TypedArray(value: unknown): value is TypedArrayType;
|
|
11
|
+
}
|
package/value/is.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
|
-
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.Is = void 0;
|
|
31
|
-
var Is;
|
|
32
|
-
(function (Is) {
|
|
33
|
-
function Object(value) {
|
|
34
|
-
return value !== null && typeof value === 'object' && !globalThis.Array.isArray(value) && !ArrayBuffer.isView(value) && !(value instanceof globalThis.Date);
|
|
35
|
-
}
|
|
36
|
-
Is.Object = Object;
|
|
37
|
-
function Date(value) {
|
|
38
|
-
return value instanceof globalThis.Date;
|
|
39
|
-
}
|
|
40
|
-
Is.Date = Date;
|
|
41
|
-
function Array(value) {
|
|
42
|
-
return globalThis.Array.isArray(value) && !ArrayBuffer.isView(value);
|
|
43
|
-
}
|
|
44
|
-
Is.Array = Array;
|
|
45
|
-
function Value(value) {
|
|
46
|
-
return value === null || value === undefined || typeof value === 'function' || typeof value === 'symbol' || typeof value === 'bigint' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string';
|
|
47
|
-
}
|
|
48
|
-
Is.Value = Value;
|
|
49
|
-
function TypedArray(value) {
|
|
50
|
-
return ArrayBuffer.isView(value);
|
|
51
|
-
}
|
|
52
|
-
Is.TypedArray = TypedArray;
|
|
53
|
-
})(Is = exports.Is || (exports.Is = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
4
|
+
@sinclair/typebox/value
|
|
5
|
+
|
|
6
|
+
The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
27
|
+
|
|
28
|
+
---------------------------------------------------------------------------*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.Is = void 0;
|
|
31
|
+
var Is;
|
|
32
|
+
(function (Is) {
|
|
33
|
+
function Object(value) {
|
|
34
|
+
return value !== null && typeof value === 'object' && !globalThis.Array.isArray(value) && !ArrayBuffer.isView(value) && !(value instanceof globalThis.Date);
|
|
35
|
+
}
|
|
36
|
+
Is.Object = Object;
|
|
37
|
+
function Date(value) {
|
|
38
|
+
return value instanceof globalThis.Date;
|
|
39
|
+
}
|
|
40
|
+
Is.Date = Date;
|
|
41
|
+
function Array(value) {
|
|
42
|
+
return globalThis.Array.isArray(value) && !ArrayBuffer.isView(value);
|
|
43
|
+
}
|
|
44
|
+
Is.Array = Array;
|
|
45
|
+
function Value(value) {
|
|
46
|
+
return value === null || value === undefined || typeof value === 'function' || typeof value === 'symbol' || typeof value === 'bigint' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string';
|
|
47
|
+
}
|
|
48
|
+
Is.Value = Value;
|
|
49
|
+
function TypedArray(value) {
|
|
50
|
+
return ArrayBuffer.isView(value);
|
|
51
|
+
}
|
|
52
|
+
Is.TypedArray = TypedArray;
|
|
53
|
+
})(Is = exports.Is || (exports.Is = {}));
|
package/value/pointer.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export declare class ValuePointerRootSetError extends Error {
|
|
2
|
-
readonly value: unknown;
|
|
3
|
-
readonly path: string;
|
|
4
|
-
readonly update: unknown;
|
|
5
|
-
constructor(value: unknown, path: string, update: unknown);
|
|
6
|
-
}
|
|
7
|
-
export declare class ValuePointerRootDeleteError extends Error {
|
|
8
|
-
readonly value: unknown;
|
|
9
|
-
readonly path: string;
|
|
10
|
-
constructor(value: unknown, path: string);
|
|
11
|
-
}
|
|
12
|
-
/** Provides functionality to update values through RFC6901 string pointers */
|
|
13
|
-
export declare namespace ValuePointer {
|
|
14
|
-
/** Formats the given pointer into navigable key components */
|
|
15
|
-
function Format(pointer: string): IterableIterator<string>;
|
|
16
|
-
/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */
|
|
17
|
-
function Set(value: any, pointer: string, update: unknown): void;
|
|
18
|
-
/** Deletes a value at the given pointer */
|
|
19
|
-
function Delete(value: any, pointer: string): void;
|
|
20
|
-
/** Returns true if a value exists at the given pointer */
|
|
21
|
-
function Has(value: any, pointer: string): boolean;
|
|
22
|
-
/** Gets the value at the given pointer */
|
|
23
|
-
function Get(value: any, pointer: string): any;
|
|
24
|
-
}
|
|
1
|
+
export declare class ValuePointerRootSetError extends Error {
|
|
2
|
+
readonly value: unknown;
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly update: unknown;
|
|
5
|
+
constructor(value: unknown, path: string, update: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare class ValuePointerRootDeleteError extends Error {
|
|
8
|
+
readonly value: unknown;
|
|
9
|
+
readonly path: string;
|
|
10
|
+
constructor(value: unknown, path: string);
|
|
11
|
+
}
|
|
12
|
+
/** Provides functionality to update values through RFC6901 string pointers */
|
|
13
|
+
export declare namespace ValuePointer {
|
|
14
|
+
/** Formats the given pointer into navigable key components */
|
|
15
|
+
function Format(pointer: string): IterableIterator<string>;
|
|
16
|
+
/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */
|
|
17
|
+
function Set(value: any, pointer: string, update: unknown): void;
|
|
18
|
+
/** Deletes a value at the given pointer */
|
|
19
|
+
function Delete(value: any, pointer: string): void;
|
|
20
|
+
/** Returns true if a value exists at the given pointer */
|
|
21
|
+
function Has(value: any, pointer: string): boolean;
|
|
22
|
+
/** Gets the value at the given pointer */
|
|
23
|
+
function Get(value: any, pointer: string): any;
|
|
24
|
+
}
|