@sinclair/typebox 0.24.50 → 0.24.52

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 (47) hide show
  1. package/compiler/compiler.d.ts +25 -28
  2. package/compiler/compiler.js +408 -409
  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 +657 -657
  11. package/errors/errors.d.ts +60 -60
  12. package/errors/errors.js +398 -398
  13. package/errors/index.d.ts +1 -1
  14. package/errors/index.js +44 -44
  15. package/format/format.d.ts +12 -12
  16. package/format/format.js +55 -55
  17. package/format/index.d.ts +1 -1
  18. package/format/index.js +44 -44
  19. package/guard/guard.d.ts +56 -56
  20. package/guard/guard.js +351 -351
  21. package/guard/index.d.ts +1 -1
  22. package/guard/index.js +44 -44
  23. package/license +22 -22
  24. package/package.json +43 -40
  25. package/readme.md +1152 -1152
  26. package/typebox.d.ts +408 -408
  27. package/typebox.js +383 -383
  28. package/value/cast.d.ts +26 -26
  29. package/value/cast.js +364 -364
  30. package/value/check.d.ts +8 -8
  31. package/value/check.js +331 -331
  32. package/value/clone.d.ts +3 -3
  33. package/value/clone.js +65 -65
  34. package/value/create.d.ts +14 -14
  35. package/value/create.js +357 -357
  36. package/value/delta.d.ts +22 -22
  37. package/value/delta.js +168 -168
  38. package/value/equal.d.ts +3 -3
  39. package/value/equal.js +74 -74
  40. package/value/index.d.ts +3 -3
  41. package/value/index.js +48 -48
  42. package/value/is.d.ts +10 -10
  43. package/value/is.js +49 -49
  44. package/value/pointer.d.ts +24 -24
  45. package/value/pointer.js +142 -142
  46. package/value/value.d.ts +31 -31
  47. package/value/value.js +81 -81
package/value/value.js CHANGED
@@ -1,81 +1,81 @@
1
- "use strict";
2
- /*--------------------------------------------------------------------------
3
-
4
- @sinclair/typebox/value
5
-
6
- The MIT License (MIT)
7
-
8
- Copyright (c) 2022 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.Value = void 0;
31
- const index_1 = require("../errors/index");
32
- const equal_1 = require("./equal");
33
- const cast_1 = require("./cast");
34
- const clone_1 = require("./clone");
35
- const create_1 = require("./create");
36
- const check_1 = require("./check");
37
- const delta_1 = require("./delta");
38
- /** Value performs immutable operations on values */
39
- var Value;
40
- (function (Value) {
41
- function Cast(...args) {
42
- const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
43
- return cast_1.ValueCast.Cast(schema, references, value);
44
- }
45
- Value.Cast = Cast;
46
- function Create(...args) {
47
- const [schema, references] = args.length === 2 ? [args[0], args[1]] : [args[0], []];
48
- return create_1.ValueCreate.Create(schema, references);
49
- }
50
- Value.Create = Create;
51
- function Check(...args) {
52
- const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
53
- return check_1.ValueCheck.Check(schema, references, value);
54
- }
55
- Value.Check = Check;
56
- function* Errors(...args) {
57
- const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
58
- yield* index_1.ValueErrors.Errors(schema, references, value);
59
- }
60
- Value.Errors = Errors;
61
- /** Returns true if left and right values are structurally equal */
62
- function Equal(left, right) {
63
- return equal_1.ValueEqual.Equal(left, right);
64
- }
65
- Value.Equal = Equal;
66
- /** Returns a structural clone of the given value */
67
- function Clone(value) {
68
- return clone_1.ValueClone.Clone(value);
69
- }
70
- Value.Clone = Clone;
71
- /** Returns edits to transform the current value into the next value */
72
- function Diff(current, next) {
73
- return delta_1.ValueDelta.Diff(current, next);
74
- }
75
- Value.Diff = Diff;
76
- /** Returns a new value with edits applied to the given value */
77
- function Patch(current, edits) {
78
- return delta_1.ValueDelta.Patch(current, edits);
79
- }
80
- Value.Patch = Patch;
81
- })(Value = exports.Value || (exports.Value = {}));
1
+ "use strict";
2
+ /*--------------------------------------------------------------------------
3
+
4
+ @sinclair/typebox/value
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2022 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.Value = void 0;
31
+ const index_1 = require("../errors/index");
32
+ const equal_1 = require("./equal");
33
+ const cast_1 = require("./cast");
34
+ const clone_1 = require("./clone");
35
+ const create_1 = require("./create");
36
+ const check_1 = require("./check");
37
+ const delta_1 = require("./delta");
38
+ /** Value performs immutable operations on values */
39
+ var Value;
40
+ (function (Value) {
41
+ function Cast(...args) {
42
+ const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
43
+ return cast_1.ValueCast.Cast(schema, references, value);
44
+ }
45
+ Value.Cast = Cast;
46
+ function Create(...args) {
47
+ const [schema, references] = args.length === 2 ? [args[0], args[1]] : [args[0], []];
48
+ return create_1.ValueCreate.Create(schema, references);
49
+ }
50
+ Value.Create = Create;
51
+ function Check(...args) {
52
+ const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
53
+ return check_1.ValueCheck.Check(schema, references, value);
54
+ }
55
+ Value.Check = Check;
56
+ function* Errors(...args) {
57
+ const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
58
+ yield* index_1.ValueErrors.Errors(schema, references, value);
59
+ }
60
+ Value.Errors = Errors;
61
+ /** Returns true if left and right values are structurally equal */
62
+ function Equal(left, right) {
63
+ return equal_1.ValueEqual.Equal(left, right);
64
+ }
65
+ Value.Equal = Equal;
66
+ /** Returns a structural clone of the given value */
67
+ function Clone(value) {
68
+ return clone_1.ValueClone.Clone(value);
69
+ }
70
+ Value.Clone = Clone;
71
+ /** Returns edits to transform the current value into the next value */
72
+ function Diff(current, next) {
73
+ return delta_1.ValueDelta.Diff(current, next);
74
+ }
75
+ Value.Diff = Diff;
76
+ /** Returns a new value with edits applied to the given value */
77
+ function Patch(current, edits) {
78
+ return delta_1.ValueDelta.Patch(current, edits);
79
+ }
80
+ Value.Patch = Patch;
81
+ })(Value = exports.Value || (exports.Value = {}));