type-plus 3.15.0 → 4.0.2

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 (210) hide show
  1. package/README.md +1 -55
  2. package/cjs/array/index.d.ts +17 -17
  3. package/cjs/array/index.js +5 -18
  4. package/cjs/array/index.js.map +1 -1
  5. package/cjs/assertion/index.js +5 -1
  6. package/cjs/assertion/index.js.map +1 -1
  7. package/cjs/class/index.d.ts +1 -1
  8. package/cjs/class/index.js +5 -2
  9. package/cjs/class/index.js.map +1 -1
  10. package/cjs/function/index.d.ts +1 -1
  11. package/cjs/function/index.js +0 -11
  12. package/cjs/function/index.js.map +1 -1
  13. package/cjs/functional/index.d.ts +1 -1
  14. package/cjs/functional/index.js +0 -12
  15. package/cjs/functional/index.js.map +1 -1
  16. package/cjs/index.d.ts +3 -7
  17. package/cjs/index.js +8 -22
  18. package/cjs/index.js.map +1 -1
  19. package/cjs/math/index.d.ts +7 -7
  20. package/cjs/math/index.js +0 -17
  21. package/cjs/math/index.js.map +1 -1
  22. package/cjs/nodejs/index.js +5 -1
  23. package/cjs/nodejs/index.js.map +1 -1
  24. package/cjs/nominal-types/index.js +5 -1
  25. package/cjs/nominal-types/index.js.map +1 -1
  26. package/cjs/object/index.d.ts +18 -18
  27. package/cjs/object/index.js +5 -19
  28. package/cjs/object/index.js.map +1 -1
  29. package/cjs/predicates/CanAssign.d.ts +1 -1
  30. package/cjs/predicates/{isEmptyObject.d.ts → IsEmptyObject.d.ts} +0 -0
  31. package/cjs/{types/AllType.js → predicates/IsEmptyObject.js} +1 -1
  32. package/cjs/predicates/IsEmptyObject.js.map +1 -0
  33. package/cjs/predicates/index.d.ts +5 -5
  34. package/cjs/predicates/index.js +5 -6
  35. package/cjs/predicates/index.js.map +1 -1
  36. package/cjs/promise/index.d.ts +2 -2
  37. package/cjs/promise/index.js +5 -3
  38. package/cjs/promise/index.js.map +1 -1
  39. package/cjs/utils/index.d.ts +1 -1
  40. package/cjs/utils/index.js +5 -2
  41. package/cjs/utils/index.js.map +1 -1
  42. package/esm/array/index.js +0 -17
  43. package/esm/array/index.js.map +1 -1
  44. package/esm/class/index.js +0 -1
  45. package/esm/class/index.js.map +1 -1
  46. package/esm/function/index.js +1 -1
  47. package/esm/function/index.js.map +1 -1
  48. package/esm/functional/index.js +1 -2
  49. package/esm/functional/index.js.map +1 -1
  50. package/esm/index.js +2 -7
  51. package/esm/index.js.map +1 -1
  52. package/esm/math/index.js +1 -7
  53. package/esm/math/index.js.map +1 -1
  54. package/esm/object/index.js +0 -18
  55. package/esm/object/index.js.map +1 -1
  56. package/esm/predicates/IsEmptyObject.js +2 -0
  57. package/esm/predicates/IsEmptyObject.js.map +1 -0
  58. package/esm/predicates/index.js +0 -5
  59. package/esm/predicates/index.js.map +1 -1
  60. package/esm/promise/index.js +0 -2
  61. package/esm/promise/index.js.map +1 -1
  62. package/esm/utils/index.js +0 -1
  63. package/esm/utils/index.js.map +1 -1
  64. package/package.json +20 -18
  65. package/ts/array/index.ts +19 -19
  66. package/ts/binary/_binary.ts +1 -1
  67. package/ts/class/index.ts +1 -1
  68. package/ts/function/index.ts +1 -1
  69. package/ts/functional/ChainFn.ts +6 -6
  70. package/ts/functional/index.ts +2 -2
  71. package/ts/index.spec.ts +6 -4
  72. package/ts/index.ts +7 -7
  73. package/ts/math/index.ts +7 -7
  74. package/ts/object/Partial.spec.ts +49 -49
  75. package/ts/object/index.ts +35 -35
  76. package/ts/predicates/CanAssign.ts +1 -1
  77. package/ts/predicates/{isEmptyObject.spec.ts → IsEmptyObject.spec.ts} +0 -0
  78. package/ts/predicates/{isEmptyObject.ts → IsEmptyObject.ts} +0 -0
  79. package/ts/predicates/index.ts +17 -17
  80. package/ts/promise/index.ts +2 -2
  81. package/ts/type-checker/typeChecker.spec.ts +2 -1
  82. package/ts/types/check.spec.ts +1 -1
  83. package/ts/types/conform.spec.ts +1 -1
  84. package/ts/types/index.ts +28 -28
  85. package/ts/types/satisfy.accept.ts +39 -38
  86. package/ts/types/satisfy.spec.ts +2 -1
  87. package/ts/utils/index.ts +2 -2
  88. package/cjs/predicates/isEmptyObject.js +0 -3
  89. package/cjs/predicates/isEmptyObject.js.map +0 -1
  90. package/cjs/types/AllType.d.ts +0 -18
  91. package/cjs/types/AllType.js.map +0 -1
  92. package/cjs/types/Any.d.ts +0 -6
  93. package/cjs/types/Any.js +0 -5
  94. package/cjs/types/Any.js.map +0 -1
  95. package/cjs/types/Array.d.ts +0 -28
  96. package/cjs/types/Array.js +0 -30
  97. package/cjs/types/Array.js.map +0 -1
  98. package/cjs/types/Boolean.d.ts +0 -29
  99. package/cjs/types/Boolean.js +0 -28
  100. package/cjs/types/Boolean.js.map +0 -1
  101. package/cjs/types/Generate.d.ts +0 -32
  102. package/cjs/types/Generate.js +0 -3
  103. package/cjs/types/Generate.js.map +0 -1
  104. package/cjs/types/Null.d.ts +0 -8
  105. package/cjs/types/Null.js +0 -10
  106. package/cjs/types/Null.js.map +0 -1
  107. package/cjs/types/Number.d.ts +0 -36
  108. package/cjs/types/Number.js +0 -50
  109. package/cjs/types/Number.js.map +0 -1
  110. package/cjs/types/Object.d.ts +0 -313
  111. package/cjs/types/Object.js +0 -35
  112. package/cjs/types/Object.js.map +0 -1
  113. package/cjs/types/Record.d.ts +0 -16
  114. package/cjs/types/Record.js +0 -17
  115. package/cjs/types/Record.js.map +0 -1
  116. package/cjs/types/String.d.ts +0 -36
  117. package/cjs/types/String.js +0 -51
  118. package/cjs/types/String.js.map +0 -1
  119. package/cjs/types/Symbol.d.ts +0 -8
  120. package/cjs/types/Symbol.js +0 -13
  121. package/cjs/types/Symbol.js.map +0 -1
  122. package/cjs/types/Tuple.d.ts +0 -35
  123. package/cjs/types/Tuple.js +0 -43
  124. package/cjs/types/Tuple.js.map +0 -1
  125. package/cjs/types/Undefined.d.ts +0 -6
  126. package/cjs/types/Undefined.js +0 -5
  127. package/cjs/types/Undefined.js.map +0 -1
  128. package/cjs/types/Union.d.ts +0 -20
  129. package/cjs/types/Union.js +0 -52
  130. package/cjs/types/Union.js.map +0 -1
  131. package/cjs/types/Unknown.d.ts +0 -6
  132. package/cjs/types/Unknown.js +0 -5
  133. package/cjs/types/Unknown.js.map +0 -1
  134. package/cjs/types/analyze.d.ts +0 -13
  135. package/cjs/types/analyze.js +0 -159
  136. package/cjs/types/analyze.js.map +0 -1
  137. package/cjs/types/check.d.ts +0 -14
  138. package/cjs/types/check.js +0 -25
  139. package/cjs/types/check.js.map +0 -1
  140. package/cjs/types/conform.d.ts +0 -15
  141. package/cjs/types/conform.js +0 -26
  142. package/cjs/types/conform.js.map +0 -1
  143. package/cjs/types/getPlainAnalysisReport.d.ts +0 -2
  144. package/cjs/types/getPlainAnalysisReport.js +0 -120
  145. package/cjs/types/getPlainAnalysisReport.js.map +0 -1
  146. package/cjs/types/index.d.ts +0 -26
  147. package/cjs/types/index.js +0 -45
  148. package/cjs/types/index.js.map +0 -1
  149. package/cjs/types/optional.d.ts +0 -328
  150. package/cjs/types/optional.js +0 -33
  151. package/cjs/types/optional.js.map +0 -1
  152. package/cjs/types/required.d.ts +0 -664
  153. package/cjs/types/required.js +0 -33
  154. package/cjs/types/required.js.map +0 -1
  155. package/cjs/types/satisfy.d.ts +0 -15
  156. package/cjs/types/satisfy.js +0 -26
  157. package/cjs/types/satisfy.js.map +0 -1
  158. package/cjs/types/types.d.ts +0 -9
  159. package/cjs/types/types.js +0 -3
  160. package/cjs/types/types.js.map +0 -1
  161. package/esm/predicates/isEmptyObject.js +0 -2
  162. package/esm/predicates/isEmptyObject.js.map +0 -1
  163. package/esm/types/AllType.js +0 -2
  164. package/esm/types/AllType.js.map +0 -1
  165. package/esm/types/Any.js +0 -2
  166. package/esm/types/Any.js.map +0 -1
  167. package/esm/types/Array.js +0 -27
  168. package/esm/types/Array.js.map +0 -1
  169. package/esm/types/Boolean.js +0 -25
  170. package/esm/types/Boolean.js.map +0 -1
  171. package/esm/types/Generate.js +0 -2
  172. package/esm/types/Generate.js.map +0 -1
  173. package/esm/types/Null.js +0 -7
  174. package/esm/types/Null.js.map +0 -1
  175. package/esm/types/Number.js +0 -30
  176. package/esm/types/Number.js.map +0 -1
  177. package/esm/types/Object.js +0 -31
  178. package/esm/types/Object.js.map +0 -1
  179. package/esm/types/Record.js +0 -14
  180. package/esm/types/Record.js.map +0 -1
  181. package/esm/types/String.js +0 -31
  182. package/esm/types/String.js.map +0 -1
  183. package/esm/types/Symbol.js +0 -10
  184. package/esm/types/Symbol.js.map +0 -1
  185. package/esm/types/Tuple.js +0 -23
  186. package/esm/types/Tuple.js.map +0 -1
  187. package/esm/types/Undefined.js +0 -2
  188. package/esm/types/Undefined.js.map +0 -1
  189. package/esm/types/Union.js +0 -32
  190. package/esm/types/Union.js.map +0 -1
  191. package/esm/types/Unknown.js +0 -2
  192. package/esm/types/Unknown.js.map +0 -1
  193. package/esm/types/analyze.js +0 -142
  194. package/esm/types/analyze.js.map +0 -1
  195. package/esm/types/check.js +0 -21
  196. package/esm/types/check.js.map +0 -1
  197. package/esm/types/conform.js +0 -22
  198. package/esm/types/conform.js.map +0 -1
  199. package/esm/types/getPlainAnalysisReport.js +0 -106
  200. package/esm/types/getPlainAnalysisReport.js.map +0 -1
  201. package/esm/types/index.js +0 -28
  202. package/esm/types/index.js.map +0 -1
  203. package/esm/types/optional.js +0 -30
  204. package/esm/types/optional.js.map +0 -1
  205. package/esm/types/required.js +0 -30
  206. package/esm/types/required.js.map +0 -1
  207. package/esm/types/satisfy.js +0 -22
  208. package/esm/types/satisfy.js.map +0 -1
  209. package/esm/types/types.js +0 -2
  210. package/esm/types/types.js.map +0 -1
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.string = void 0;
13
- var Undefined_1 = require("./Undefined");
14
- var Union_1 = require("./Union");
15
- /**
16
- * Creates a constant string type.
17
- */
18
- function create(value) {
19
- // Cannot name this function as `const` because it is a reserved keyword.
20
- return { type: 'string', value: value };
21
- }
22
- var any = create(undefined);
23
- exports.string = Object.assign(any, {
24
- any: any,
25
- create: create,
26
- // @ts-ignore we know that this can be infinite
27
- list: function (value) {
28
- var values = [];
29
- for (var _i = 1; _i < arguments.length; _i++) {
30
- values[_i - 1] = arguments[_i];
31
- }
32
- return Union_1.union.create.apply(Union_1.union, __spreadArray([create(value)], values.map(create), false));
33
- },
34
- optional: Object.assign(Union_1.union.create(any, Undefined_1.undef), {
35
- /**
36
- * Creates an optional constant string type.
37
- */
38
- create: function (value) {
39
- return Union_1.union.create(create(value), Undefined_1.undef);
40
- },
41
- // @ts-ignore we know that this can be infinite
42
- list: function (value) {
43
- var values = [];
44
- for (var _i = 1; _i < arguments.length; _i++) {
45
- values[_i - 1] = arguments[_i];
46
- }
47
- return Union_1.union.create.apply(Union_1.union, __spreadArray(__spreadArray([create(value)], values.map(create), false), [Undefined_1.undef], false));
48
- }
49
- })
50
- });
51
- //# sourceMappingURL=String.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"String.js","sourceRoot":"","sources":["../../ts/types/String.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAA8C;AAC9C,iCAAsC;AAiBtC;;EAEE;AACF,SAAS,MAAM,CAAuB,KAAY;IAChD,yEAAyE;IACzE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AACzC,CAAC;AACD,IAAM,GAAG,GAAG,MAAM,CAAC,SAA8B,CAAC,CAAA;AAErC,QAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;IACvC,GAAG,KAAA;IACH,MAAM,QAAA;IACN,+CAA+C;IAC/C,IAAI,EAAJ,UAAoD,KAAY;QAAE,gBAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,+BAAiB;;QAKjF,OAAO,aAAK,CAAC,MAAM,OAAZ,aAAK,iBAAQ,MAAM,CAAC,KAAK,CAAC,GAAK,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAQ,CAAA;IAClE,CAAC;IACD,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,aAAK,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAK,CAAC,EAAE;QAChD;;WAEG;QACH,MAAM,EAAN,UAA6B,KAAY;YACvC,OAAO,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,iBAAK,CAAC,CAAA;QAC3C,CAAC;QACD,+CAA+C;QAC/C,IAAI,EAAJ,UAAoD,KAAY;YAAE,gBAAiB;iBAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;gBAAjB,+BAAiB;;YAIjF,OAAO,aAAK,CAAC,MAAM,OAAZ,aAAK,+BAAQ,MAAM,CAAC,KAAK,CAAC,GAAK,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,WAAE,iBAAK,UAAQ,CAAA;QACzE,CAAC;KACF,CAAC;CACH,CAAC,CAAA"}
@@ -1,8 +0,0 @@
1
- import { TypeAnalysis, Type } from './types';
2
- export declare type Symbol<Value extends string = string> = Type<'symbol', Value>;
3
- export declare namespace Symbol {
4
- type Analysis = TypeAnalysis<'symbol'>;
5
- }
6
- export declare const symbol: Symbol<string> & {
7
- optional: import("./Union").Union<[Symbol<string>, import("./Undefined").Undefined]>;
8
- };
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.symbol = void 0;
4
- var Undefined_1 = require("./Undefined");
5
- var Union_1 = require("./Union");
6
- function create(value) {
7
- return { type: 'symbol', value: value };
8
- }
9
- var any = create(undefined);
10
- exports.symbol = Object.assign(any, {
11
- optional: Union_1.union.create(any, Undefined_1.undef)
12
- });
13
- //# sourceMappingURL=Symbol.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Symbol.js","sourceRoot":"","sources":["../../ts/types/Symbol.ts"],"names":[],"mappings":";;;AACA,yCAAmC;AACnC,iCAA+B;AAQ/B,SAAS,MAAM,CAAuB,KAAY;IAChD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAA,EAAE,CAAA;AAClC,CAAC;AAED,IAAM,GAAG,GAAG,MAAM,CAAC,SAA8B,CAAC,CAAA;AAErC,QAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;IACvC,QAAQ,EAAE,aAAK,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAK,CAAC;CACnC,CAAC,CAAA"}
@@ -1,35 +0,0 @@
1
- import { TypeAnalysis, Type } from './types';
2
- import { AllType } from './AllType';
3
- import { Undefined } from './Undefined';
4
- import { Union } from './Union';
5
- import { Tail } from '../array';
6
- export declare type Tuple<Values extends AllType[] = any[]> = Type<'tuple', Values>;
7
- export declare namespace Tuple {
8
- type Analysis<Value extends AllType.PrimitiveValues | AllType.Analysis = any> = TypeAnalysis<'tuple', Value[]>;
9
- type FindByProp<Tuple extends Array<{
10
- [K in Key]: any;
11
- }>, Key extends string, Value> = FindByProp._<Tuple, Key, Value>['result'];
12
- namespace FindByProp {
13
- type _<Tuple extends Array<{
14
- [K in Key]: any;
15
- }>, Key extends string, Value> = Tuple['length'] extends 0 ? {
16
- result: never;
17
- } : {
18
- result: Value extends Tuple[0][Key] ? Tuple[0] : _<Tail<Tuple>, Key, Value>['result'];
19
- };
20
- }
21
- }
22
- /**
23
- * Creates a tuple type.
24
- */
25
- declare function create<Value extends AllType, Values extends AllType[]>(value: Value, ...values: Values): Tuple<[Value, ...Values]>;
26
- export declare const tuple: {
27
- create: typeof create;
28
- optional: {
29
- /**
30
- * Creates an optional tuple type.
31
- */
32
- create<Value extends AllType, Values extends AllType[]>(value: Value, ...values: Values): Union<[Tuple<[Value, ...Values]>, Undefined]>;
33
- };
34
- };
35
- export {};
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.tuple = void 0;
13
- var Undefined_1 = require("./Undefined");
14
- var Union_1 = require("./Union");
15
- /**
16
- * Creates a tuple type.
17
- */
18
- function create(value) {
19
- var values = [];
20
- for (var _i = 1; _i < arguments.length; _i++) {
21
- values[_i - 1] = arguments[_i];
22
- }
23
- return {
24
- type: 'tuple',
25
- value: __spreadArray([value], values, true)
26
- };
27
- }
28
- exports.tuple = {
29
- create: create,
30
- optional: {
31
- /**
32
- * Creates an optional tuple type.
33
- */
34
- create: function (value) {
35
- var values = [];
36
- for (var _i = 1; _i < arguments.length; _i++) {
37
- values[_i - 1] = arguments[_i];
38
- }
39
- return Union_1.union.create(create.apply(void 0, __spreadArray([value], values, false)), Undefined_1.undef);
40
- }
41
- }
42
- };
43
- //# sourceMappingURL=Tuple.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tuple.js","sourceRoot":"","sources":["../../ts/types/Tuple.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAA8C;AAC9C,iCAAsC;AAqBtC;;GAEG;AACH,SAAS,MAAM,CACb,KAAY;IACZ,gBAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,+BAAiB;;IAEjB,OAAO;QACL,IAAI,EAAE,OAAO;QACb,KAAK,iBAAG,KAAK,GAAK,MAAM,OAAC;KAC1B,CAAA;AACH,CAAC;AACY,QAAA,KAAK,GAAG;IACnB,MAAM,QAAA;IACN,QAAQ,EAAE;QACR;;WAEG;QACH,MAAM,EAAN,UACE,KAAY;YACZ,gBAAiB;iBAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;gBAAjB,+BAAiB;;YAEjB,OAAO,aAAK,CAAC,MAAM,CAAC,MAAM,8BAAC,KAAK,GAAK,MAAM,WAAG,iBAAK,CAAC,CAAA;QACtD,CAAC;KACF;CACF,CAAA"}
@@ -1,6 +0,0 @@
1
- import { TypeAnalysis, Type } from './types';
2
- export declare type Undefined = Type<'undefined', undefined>;
3
- export declare namespace Undefined {
4
- type Analysis = TypeAnalysis<'undefined'>;
5
- }
6
- export declare const undef: Undefined;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.undef = void 0;
4
- exports.undef = { type: 'undefined', value: undefined };
5
- //# sourceMappingURL=Undefined.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Undefined.js","sourceRoot":"","sources":["../../ts/types/Undefined.ts"],"names":[],"mappings":";;;AAOa,QAAA,KAAK,GAAc,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA"}
@@ -1,20 +0,0 @@
1
- import { AllType } from './AllType';
2
- import { TypeAnalysis, Type } from './types';
3
- export declare type Union<Values extends AllType[] = any[]> = Type<'union', Values>;
4
- export declare namespace Union {
5
- type Analysis<Value extends AllType.PrimitiveValues | AllType.Analysis = any> = TypeAnalysis<'union', Value[]>;
6
- }
7
- /**
8
- * Create union type.
9
- */
10
- declare function create<Value extends AllType, Values extends AllType[]>(value: Value, ...values: Values): Values['length'] extends 0 ? Value : Union<[Value, ...Values]>;
11
- export declare const union: {
12
- create: typeof create;
13
- optional: {
14
- /**
15
- * Creates an optional unional type.
16
- */
17
- create<Value extends AllType, Values extends AllType[]>(value: Value, ...values: Values): Values["length"] extends 0 ? Value : Union<[Value, ...Values]>;
18
- };
19
- };
20
- export {};
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.union = void 0;
13
- var Undefined_1 = require("./Undefined");
14
- /**
15
- * Create union type.
16
- */
17
- function create(value) {
18
- var values = [];
19
- for (var _i = 1; _i < arguments.length; _i++) {
20
- values[_i - 1] = arguments[_i];
21
- }
22
- values.unshift(value);
23
- if (values.length === 1)
24
- return values[0];
25
- var v = values.reduce(function (p, v) {
26
- if (v.type === 'union') {
27
- p.push.apply(p, v.value);
28
- }
29
- else {
30
- p.push(v);
31
- }
32
- return p;
33
- }, []);
34
- return { type: 'union', value: v };
35
- }
36
- exports.union = {
37
- create: create,
38
- optional: {
39
- /**
40
- * Creates an optional unional type.
41
- */
42
- create: function (value) {
43
- var values = [];
44
- for (var _i = 1; _i < arguments.length; _i++) {
45
- values[_i - 1] = arguments[_i];
46
- }
47
- values.push(Undefined_1.undef);
48
- return create.apply(void 0, __spreadArray([value], values, false));
49
- }
50
- }
51
- };
52
- //# sourceMappingURL=Union.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Union.js","sourceRoot":"","sources":["../../ts/types/Union.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAAmC;AAWnC;;GAEG;AACH,SAAS,MAAM,CAEb,KAAY;IAAE,gBAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,+BAAiB;;IAE/B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACrB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAQ,CAAA;IAChD,IAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAY,UAAC,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE;YACtB,CAAC,CAAC,IAAI,OAAN,CAAC,EAAU,CAAS,CAAC,KAAK,EAAC;SAC5B;aACI;YACH,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SACV;QACD,OAAO,CAAC,CAAA;IACV,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAS,CAAA;AAC3C,CAAC;AAEY,QAAA,KAAK,GAAG;IACnB,MAAM,QAAA;IACN,QAAQ,EAAE;QACR;;WAEG;QACH,MAAM,EAAN,UAAwD,KAAY;YAAE,gBAAiB;iBAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;gBAAjB,+BAAiB;;YACrF,MAAM,CAAC,IAAI,CAAC,iBAAK,CAAC,CAAA;YAClB,OAAO,MAAM,8BAAC,KAAK,GAAK,MAAM,UAAC;QACjC,CAAC;KACF;CACF,CAAA"}
@@ -1,6 +0,0 @@
1
- import { TypeAnalysis, Type } from './types';
2
- export declare type Unknown = Type<'unknown', undefined>;
3
- export declare namespace Unknown {
4
- type Analysis = TypeAnalysis<'unknown'>;
5
- }
6
- export declare const unknown: Unknown;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unknown = void 0;
4
- exports.unknown = { type: 'unknown', value: undefined };
5
- //# sourceMappingURL=Unknown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Unknown.js","sourceRoot":"","sources":["../../ts/types/Unknown.ts"],"names":[],"mappings":";;;AAQa,QAAA,OAAO,GAAY,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA"}
@@ -1,13 +0,0 @@
1
- import { AllType } from './AllType';
2
- export declare namespace analyze {
3
- type Options = {
4
- strict: boolean;
5
- };
6
- type Result = {
7
- options: Options;
8
- analysis: AllType.Analysis;
9
- actual: any;
10
- };
11
- }
12
- export declare function analyze(options: analyze.Options, type: AllType, actual: unknown): analyze.Result;
13
- export declare function analyzeInternal(options: analyze.Options, type: AllType, actual: unknown): AllType.Analysis;
@@ -1,159 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.analyzeInternal = exports.analyze = void 0;
15
- var object_1 = require("../object");
16
- var Number_1 = require("./Number");
17
- var Object_1 = require("./Object");
18
- var String_1 = require("./String");
19
- function analyze(options, type, actual) {
20
- return {
21
- options: options,
22
- analysis: analyzeInternal(options, type, actual),
23
- actual: actual
24
- };
25
- }
26
- exports.analyze = analyze;
27
- function analyzeInternal(options, type, actual) {
28
- var t = type['type'];
29
- switch (t) {
30
- case 'unknown':
31
- case 'any':
32
- return ok(type);
33
- case 'undefined':
34
- case 'symbol':
35
- return typeof actual === t ? ok(type) : fail(t);
36
- case 'null':
37
- return actual === null ? ok(type) : fail(t);
38
- case 'boolean': return analyzeBoolean(type, actual);
39
- case 'number': return analyzeType(Number_1.number, type, actual);
40
- case 'string': return analyzeType(String_1.string, type, actual);
41
- // case 'bigint': return analyzeType(bigint, type as BigInt, actual)
42
- case 'object': return analyzeObject(options, type, actual);
43
- case 'record': return analyzeRecord(options, type, actual);
44
- case 'array': return analyzeArray(options, type, actual);
45
- case 'tuple': return analyzeTuple(options, type, actual);
46
- case 'union': return analyzeUnion(options, type, actual);
47
- }
48
- }
49
- exports.analyzeInternal = analyzeInternal;
50
- function analyzeBoolean(type, actual) {
51
- var value = type['value'];
52
- if (value === undefined) {
53
- return typeof actual === 'boolean' ? ok(type) : fail('boolean', value);
54
- }
55
- else {
56
- return value === actual ? ok(type) : fail('boolean', value);
57
- }
58
- }
59
- function analyzeType(baseType, // | BigInt,
60
- type, actual) {
61
- var value = type['value'];
62
- return typeof actual === baseType['type'] && (type === baseType || actual === value)
63
- ? ok(type)
64
- : fail(type['type'], type['value']);
65
- }
66
- function analyzeUnion(options, type, actual) {
67
- var subTypes = type['value'];
68
- var r = subTypes.map(function (t) { return analyzeInternal(options, t, actual); });
69
- return r.some(function (r) { return !r.fail; }) ? ok(type) : fail('union', r);
70
- }
71
- function analyzeArray(options, type, actual) {
72
- var subType = type['value'];
73
- if (!Array.isArray(actual))
74
- return fail('array', subType ? ok(subType) : undefined);
75
- if (subType === undefined)
76
- return ok(type);
77
- var r = actual.reduce(function (p, a, i) {
78
- var r = analyzeInternal(options, subType, a);
79
- if (r.fail) {
80
- p.value = r.value;
81
- p.keys.push(i);
82
- p.actual.push(a);
83
- }
84
- return p;
85
- }, { keys: [], actual: [] });
86
- return r.keys.length === 0 ?
87
- ok(type) :
88
- fail('array', __assign({}, fail(subType['type'], r.value)));
89
- }
90
- function analyzeTuple(options, type, actual) {
91
- var value = type['value'];
92
- if (!Array.isArray(actual))
93
- return fail('tuple', value.map(ok));
94
- var results = value.map(function (v, i) { return analyzeInternal(options, v, actual[i]); });
95
- if (options.strict && results.length < actual.length) {
96
- return fail('tuple', results);
97
- }
98
- return results.every(function (r) { return !r.fail; }) ? ok(type) : fail('tuple', results);
99
- }
100
- function analyzeObject(options, type, actual) {
101
- var typeMap = type['value'];
102
- if (!isOnlyObject(actual))
103
- return fail('object', typeMap ? Object_1.object.map(function (v) { return ok(v); }, typeMap) : undefined);
104
- if (type === Object_1.object)
105
- return ok(type);
106
- var typeKeys = Object.keys(typeMap);
107
- var s = __assign({}, actual);
108
- var results = typeKeys.reduce(function (p, k) {
109
- var r = p.value[k] = analyzeInternal(options, typeMap[k], actual[k]);
110
- p.fail || (p.fail = !!r.fail);
111
- s[k] = undefined;
112
- return p;
113
- }, { fail: false, value: {} });
114
- var skeys = Object.keys(s);
115
- if (options.strict && skeys.length > typeKeys.length) {
116
- return fail('object', results.value);
117
- }
118
- return !results.fail ? ok(type) : fail('object', results.value);
119
- }
120
- function analyzeRecord(options, type, actual) {
121
- var subType = type['value'];
122
- if (!isOnlyObject(actual))
123
- return fail('record', ok(subType));
124
- var r = (0, object_1.reduceByKey)(actual, function (p, k) {
125
- var r = analyzeInternal(options, subType, actual[k]);
126
- if (r.fail) {
127
- p.value = r.value;
128
- p.keys.push(k);
129
- p.actual.push(actual[k]);
130
- }
131
- return p;
132
- }, { keys: [], actual: [], value: undefined });
133
- return r.keys.length === 0 ?
134
- ok(type) :
135
- fail('record', __assign({}, fail(subType['type'], r.value)));
136
- }
137
- function ok(t) {
138
- var type = t['type'];
139
- var value = t['value'];
140
- if (value === undefined)
141
- return { type: type, value: value };
142
- if (typeof value !== 'object' || value === null)
143
- return { type: type, value: value };
144
- if (Array.isArray(value))
145
- return { type: type, value: value.map(ok) };
146
- if (value['type'])
147
- return { type: type, value: ok(value) };
148
- return {
149
- type: type,
150
- value: (0, object_1.reduceByKey)(value, function (p, k) { return (p[k] = ok(value[k]), p); }, {})
151
- };
152
- }
153
- function fail(type, value) {
154
- return value === undefined ? { type: type, fail: true } : { type: type, value: value, fail: true };
155
- }
156
- function isOnlyObject(actual) {
157
- return typeof actual === 'object' && actual !== null && !Array.isArray(actual);
158
- }
159
- //# sourceMappingURL=analyze.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../ts/types/analyze.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oCAAuC;AAIvC,mCAAyC;AACzC,mCAA6C;AAE7C,mCAAyC;AAazC,SAAgB,OAAO,CAAC,OAAwB,EAAE,IAAa,EAAE,MAAe;IAC9E,OAAO;QACL,OAAO,SAAA;QACP,QAAQ,EAAE,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,C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CAAA;IACtE,IAAI,KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,IAAI,MAAA,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAS,CAAA;IAC3D,OAAO;QACL,IAAI,MAAA;QAAE,KAAK,EAAE,IAAA,oBAAW,EACtB,KAA4B,EAC5B,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAxB,CAAwB,EAClC,EAAyB,CAAC;KACtB,CAAA;AACV,CAAC;AAED,SAAS,IAAI,CAAC,IAA8B,EAAE,KAAiC;IAC7E,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,MAAA,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AACjF,CAAC;AAED,SAAS,YAAY,CAAC,MAAe;IACnC,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AAChF,CAAC"}
@@ -1,14 +0,0 @@
1
- import { AllType } from './AllType';
2
- import { analyze } from './analyze';
3
- import { Generate } from './Generate';
4
- /**
5
- * Checks if the specified `subject` against the `type`.
6
- * @return type guard (boolean). If the subject does not check to the type,
7
- * the detail report is available in `check.result`,
8
- * and you can get a string report using `check.getReport()`
9
- */
10
- export declare function check<T extends AllType>(options: analyze.Options, type: T, subject: unknown): subject is Generate<T>;
11
- export declare namespace check {
12
- var result: analyze.Result;
13
- var getReport: () => string;
14
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.check = void 0;
4
- var analyze_1 = require("./analyze");
5
- var getPlainAnalysisReport_1 = require("./getPlainAnalysisReport");
6
- /**
7
- * Checks if the specified `subject` against the `type`.
8
- * @return type guard (boolean). If the subject does not check to the type,
9
- * the detail report is available in `check.result`,
10
- * and you can get a string report using `check.getReport()`
11
- */
12
- function check(options, type, subject) {
13
- var result = check.result = (0, analyze_1.analyze)(options, type, subject);
14
- return !result.analysis.fail;
15
- }
16
- exports.check = check;
17
- /**
18
- * Analysis report.
19
- */
20
- check.result = { analysis: {}, actual: undefined };
21
- /**
22
- * Gets a simple report of the analysis.
23
- */
24
- check.getReport = function () { return (0, getPlainAnalysisReport_1.getPlainAnalysisReport)(check.result); };
25
- //# sourceMappingURL=check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../ts/types/check.ts"],"names":[],"mappings":";;;AACA,qCAAmC;AAEnC,mEAAiE;AAEjE;;;;;GAKG;AACH,SAAgB,KAAK,CAAoB,OAAwB,EAAE,IAAO,EAAE,OAAgB;IAC1F,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,IAAA,iBAAO,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IAC7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;AAC9B,CAAC;AAHD,sBAGC;AAED;;GAEG;AACH,KAAK,CAAC,MAAM,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAoB,CAAA;AAEpE;;GAEG;AACH,KAAK,CAAC,SAAS,GAAG,cAAM,OAAA,IAAA,+CAAsB,EAAC,KAAK,CAAC,MAAM,CAAC,EAApC,CAAoC,CAAA"}
@@ -1,15 +0,0 @@
1
- import { AllType } from './AllType';
2
- import { analyze } from './analyze';
3
- import { Generate } from './Generate';
4
- /**
5
- * Checks if the specified `subject` conforms to the `type`.
6
- * `conform()` is the shortcut of `check({ strict: true }, ...)`.
7
- * @return type guard (boolean). If the subject does not conform to the type,
8
- * the detail report is available in `conform.result`,
9
- * and you can get a string report using `conform.getReport()`
10
- */
11
- export declare function conform<T extends AllType>(type: T, subject: unknown): subject is Generate<T>;
12
- export declare namespace conform {
13
- var result: analyze.Result;
14
- var getReport: () => string;
15
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.conform = void 0;
4
- var analyze_1 = require("./analyze");
5
- var getPlainAnalysisReport_1 = require("./getPlainAnalysisReport");
6
- /**
7
- * Checks if the specified `subject` conforms to the `type`.
8
- * `conform()` is the shortcut of `check({ strict: true }, ...)`.
9
- * @return type guard (boolean). If the subject does not conform to the type,
10
- * the detail report is available in `conform.result`,
11
- * and you can get a string report using `conform.getReport()`
12
- */
13
- function conform(type, subject) {
14
- var result = conform.result = (0, analyze_1.analyze)({ strict: true }, type, subject);
15
- return !result.analysis.fail;
16
- }
17
- exports.conform = conform;
18
- /**
19
- * Analysis report.
20
- */
21
- conform.result = { analysis: {}, actual: undefined };
22
- /**
23
- * Gets a simple report of the analysis.
24
- */
25
- conform.getReport = function () { return (0, getPlainAnalysisReport_1.getPlainAnalysisReport)(conform.result); };
26
- //# sourceMappingURL=conform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conform.js","sourceRoot":"","sources":["../../ts/types/conform.ts"],"names":[],"mappings":";;;AACA,qCAAmC;AAEnC,mEAAiE;AAEjE;;;;;;GAMG;AACH,SAAgB,OAAO,CAAoB,IAAO,EAAE,OAAgB;IAClE,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAA,iBAAO,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACxE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;AAC9B,CAAC;AAHD,0BAGC;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAoB,CAAA;AAEtE;;GAEG;AACH,OAAO,CAAC,SAAS,GAAG,cAAM,OAAA,IAAA,+CAAsB,EAAC,OAAO,CAAC,MAAM,CAAC,EAAtC,CAAsC,CAAA"}
@@ -1,2 +0,0 @@
1
- import { analyze } from './analyze';
2
- export declare function getPlainAnalysisReport(analysisResult: analyze.Result): string;