@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.
Files changed (61) hide show
  1. package/compiler/compiler.d.ts +25 -28
  2. package/compiler/compiler.js +495 -495
  3. package/compiler/index.d.ts +2 -2
  4. package/compiler/index.js +47 -47
  5. package/conditional/conditional.d.ts +17 -17
  6. package/conditional/conditional.js +91 -91
  7. package/conditional/index.d.ts +2 -2
  8. package/conditional/index.js +45 -45
  9. package/conditional/structural.d.ts +11 -11
  10. package/conditional/structural.js +685 -685
  11. package/custom/custom.d.ts +12 -12
  12. package/custom/custom.js +55 -55
  13. package/custom/index.d.ts +1 -1
  14. package/custom/index.js +44 -44
  15. package/errors/errors.d.ts +67 -67
  16. package/errors/errors.js +472 -468
  17. package/errors/index.d.ts +1 -1
  18. package/errors/index.js +44 -44
  19. package/format/format.d.ts +12 -12
  20. package/format/format.js +55 -55
  21. package/format/index.d.ts +1 -1
  22. package/format/index.js +44 -44
  23. package/guard/extends.d.ts +10 -0
  24. package/guard/extends.js +50 -0
  25. package/guard/guard.d.ts +60 -60
  26. package/guard/guard.js +440 -440
  27. package/guard/index.d.ts +2 -1
  28. package/guard/index.js +45 -44
  29. package/hash/hash.d.ts +8 -8
  30. package/hash/hash.js +183 -183
  31. package/hash/index.d.ts +1 -1
  32. package/hash/index.js +44 -44
  33. package/license +22 -22
  34. package/package.json +55 -52
  35. package/readme.md +1237 -1325
  36. package/system/index.d.ts +1 -1
  37. package/system/index.js +44 -44
  38. package/system/system.d.ts +17 -17
  39. package/system/system.js +69 -69
  40. package/typebox.d.ts +422 -422
  41. package/typebox.js +388 -388
  42. package/value/cast.d.ts +26 -26
  43. package/value/cast.js +415 -420
  44. package/value/check.d.ts +8 -8
  45. package/value/check.js +405 -395
  46. package/value/clone.d.ts +3 -3
  47. package/value/clone.js +71 -71
  48. package/value/create.d.ts +14 -14
  49. package/value/create.js +378 -388
  50. package/value/delta.d.ts +43 -43
  51. package/value/delta.js +204 -204
  52. package/value/equal.d.ts +3 -3
  53. package/value/equal.js +80 -80
  54. package/value/index.d.ts +4 -4
  55. package/value/index.js +53 -53
  56. package/value/is.d.ts +11 -11
  57. package/value/is.js +53 -53
  58. package/value/pointer.d.ts +24 -24
  59. package/value/pointer.js +142 -142
  60. package/value/value.d.ts +32 -32
  61. package/value/value.js +87 -87
package/value/clone.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare namespace ValueClone {
2
- function Clone<T extends unknown>(value: T): T;
3
- }
1
+ export declare namespace ValueClone {
2
+ function Clone<T extends unknown>(value: T): T;
3
+ }
package/value/clone.js CHANGED
@@ -1,71 +1,71 @@
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.ValueClone = void 0;
31
- const is_1 = require("./is");
32
- var ValueClone;
33
- (function (ValueClone) {
34
- function Array(value) {
35
- return value.map((element) => Clone(element));
36
- }
37
- function Date(value) {
38
- return new globalThis.Date(value.toISOString());
39
- }
40
- function Object(value) {
41
- const keys = [...globalThis.Object.keys(value), ...globalThis.Object.getOwnPropertySymbols(value)];
42
- return keys.reduce((acc, key) => ({ ...acc, [key]: Clone(value[key]) }), {});
43
- }
44
- function TypedArray(value) {
45
- return value.slice();
46
- }
47
- function Value(value) {
48
- return value;
49
- }
50
- function Clone(value) {
51
- if (is_1.Is.Date(value)) {
52
- return Date(value);
53
- }
54
- else if (is_1.Is.Object(value)) {
55
- return Object(value);
56
- }
57
- else if (is_1.Is.Array(value)) {
58
- return Array(value);
59
- }
60
- else if (is_1.Is.TypedArray(value)) {
61
- return TypedArray(value);
62
- }
63
- else if (is_1.Is.Value(value)) {
64
- return Value(value);
65
- }
66
- else {
67
- throw new Error('ValueClone: Unable to clone value');
68
- }
69
- }
70
- ValueClone.Clone = Clone;
71
- })(ValueClone = exports.ValueClone || (exports.ValueClone = {}));
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.ValueClone = void 0;
31
+ const is_1 = require("./is");
32
+ var ValueClone;
33
+ (function (ValueClone) {
34
+ function Array(value) {
35
+ return value.map((element) => Clone(element));
36
+ }
37
+ function Date(value) {
38
+ return new globalThis.Date(value.toISOString());
39
+ }
40
+ function Object(value) {
41
+ const keys = [...globalThis.Object.keys(value), ...globalThis.Object.getOwnPropertySymbols(value)];
42
+ return keys.reduce((acc, key) => ({ ...acc, [key]: Clone(value[key]) }), {});
43
+ }
44
+ function TypedArray(value) {
45
+ return value.slice();
46
+ }
47
+ function Value(value) {
48
+ return value;
49
+ }
50
+ function Clone(value) {
51
+ if (is_1.Is.Date(value)) {
52
+ return Date(value);
53
+ }
54
+ else if (is_1.Is.Object(value)) {
55
+ return Object(value);
56
+ }
57
+ else if (is_1.Is.Array(value)) {
58
+ return Array(value);
59
+ }
60
+ else if (is_1.Is.TypedArray(value)) {
61
+ return TypedArray(value);
62
+ }
63
+ else if (is_1.Is.Value(value)) {
64
+ return Value(value);
65
+ }
66
+ else {
67
+ throw new Error('ValueClone: Unable to clone value');
68
+ }
69
+ }
70
+ ValueClone.Clone = Clone;
71
+ })(ValueClone = exports.ValueClone || (exports.ValueClone = {}));
package/value/create.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import * as Types from '../typebox';
2
- export declare class ValueCreateUnknownTypeError extends Error {
3
- readonly schema: Types.TSchema;
4
- constructor(schema: Types.TSchema);
5
- }
6
- export declare class ValueCreateNeverTypeError extends Error {
7
- readonly schema: Types.TSchema;
8
- constructor(schema: Types.TSchema);
9
- }
10
- export declare namespace ValueCreate {
11
- /** Creates a value from the given schema. If the schema specifies a default value, then that value is returned. */
12
- function Visit<T extends Types.TSchema>(schema: T, references: Types.TSchema[]): Types.Static<T>;
13
- function Create<T extends Types.TSchema, R extends Types.TSchema[]>(schema: T, references: [...R]): Types.Static<T>;
14
- }
1
+ import * as Types from '../typebox';
2
+ export declare class ValueCreateUnknownTypeError extends Error {
3
+ readonly schema: Types.TSchema;
4
+ constructor(schema: Types.TSchema);
5
+ }
6
+ export declare class ValueCreateNeverTypeError extends Error {
7
+ readonly schema: Types.TSchema;
8
+ constructor(schema: Types.TSchema);
9
+ }
10
+ export declare namespace ValueCreate {
11
+ /** Creates a value from the given schema. If the schema specifies a default value, then that value is returned. */
12
+ function Visit<T extends Types.TSchema>(schema: T, references: Types.TSchema[]): Types.Static<T>;
13
+ function Create<T extends Types.TSchema, R extends Types.TSchema[]>(schema: T, references: [...R]): Types.Static<T>;
14
+ }