@bemedev/typings 0.0.2 → 0.2.0

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 (120) hide show
  1. package/README.md +12 -11
  2. package/lib/constants.cjs +26 -18
  3. package/lib/constants.cjs.map +1 -1
  4. package/lib/constants.d.ts +3 -4
  5. package/lib/constants.js +24 -15
  6. package/lib/constants.js.map +1 -1
  7. package/lib/helpers/any.cjs +4 -4
  8. package/lib/helpers/any.cjs.map +1 -1
  9. package/lib/helpers/any.d.ts +2 -3
  10. package/lib/helpers/any.js +4 -2
  11. package/lib/helpers/any.js.map +1 -1
  12. package/lib/helpers/array.cjs +6 -7
  13. package/lib/helpers/array.cjs.map +1 -1
  14. package/lib/helpers/array.d.ts +2 -3
  15. package/lib/helpers/array.js +6 -5
  16. package/lib/helpers/array.js.map +1 -1
  17. package/lib/helpers/custom.cjs +6 -9
  18. package/lib/helpers/custom.cjs.map +1 -1
  19. package/lib/helpers/custom.d.ts +0 -1
  20. package/lib/helpers/custom.js +6 -7
  21. package/lib/helpers/custom.js.map +1 -1
  22. package/lib/helpers/index.cjs +27 -30
  23. package/lib/helpers/index.d.ts +13 -13
  24. package/lib/helpers/index.js +14 -13
  25. package/lib/helpers/intersection.cjs +10 -11
  26. package/lib/helpers/intersection.cjs.map +1 -1
  27. package/lib/helpers/intersection.d.ts +0 -1
  28. package/lib/helpers/intersection.js +10 -9
  29. package/lib/helpers/intersection.js.map +1 -1
  30. package/lib/helpers/litterals.cjs +4 -4
  31. package/lib/helpers/litterals.cjs.map +1 -1
  32. package/lib/helpers/litterals.d.ts +0 -1
  33. package/lib/helpers/litterals.js +4 -2
  34. package/lib/helpers/litterals.js.map +1 -1
  35. package/lib/helpers/optional.cjs +7 -0
  36. package/lib/helpers/optional.cjs.map +1 -0
  37. package/lib/helpers/optional.d.ts +3 -0
  38. package/lib/helpers/optional.js +7 -0
  39. package/lib/helpers/optional.js.map +1 -0
  40. package/lib/helpers/partial.cjs +11 -12
  41. package/lib/helpers/partial.cjs.map +1 -1
  42. package/lib/helpers/partial.d.ts +2 -3
  43. package/lib/helpers/partial.js +11 -10
  44. package/lib/helpers/partial.js.map +1 -1
  45. package/lib/helpers/primitiveObject.cjs +10 -0
  46. package/lib/helpers/primitiveObject.cjs.map +1 -0
  47. package/lib/helpers/primitiveObject.d.ts +5 -0
  48. package/lib/helpers/primitiveObject.js +11 -0
  49. package/lib/helpers/primitiveObject.js.map +1 -0
  50. package/lib/helpers/record.cjs +8 -9
  51. package/lib/helpers/record.cjs.map +1 -1
  52. package/lib/helpers/record.d.ts +2 -3
  53. package/lib/helpers/record.js +8 -7
  54. package/lib/helpers/record.js.map +1 -1
  55. package/lib/helpers/soa.cjs +6 -7
  56. package/lib/helpers/soa.cjs.map +1 -1
  57. package/lib/helpers/soa.d.ts +2 -3
  58. package/lib/helpers/soa.js +6 -5
  59. package/lib/helpers/soa.js.map +1 -1
  60. package/lib/helpers/sv.cjs +4 -4
  61. package/lib/helpers/sv.cjs.map +1 -1
  62. package/lib/helpers/sv.d.ts +0 -1
  63. package/lib/helpers/sv.js +4 -2
  64. package/lib/helpers/sv.js.map +1 -1
  65. package/lib/helpers/tuple.cjs +4 -4
  66. package/lib/helpers/tuple.cjs.map +1 -1
  67. package/lib/helpers/tuple.d.ts +2 -3
  68. package/lib/helpers/tuple.js +4 -2
  69. package/lib/helpers/tuple.js.map +1 -1
  70. package/lib/helpers/union.cjs +7 -10
  71. package/lib/helpers/union.cjs.map +1 -1
  72. package/lib/helpers/union.d.ts +4 -5
  73. package/lib/helpers/union.js +7 -8
  74. package/lib/helpers/union.js.map +1 -1
  75. package/lib/index.cjs +40 -40
  76. package/lib/index.d.ts +1 -2
  77. package/lib/index.js +18 -15
  78. package/lib/type.d.ts +2 -0
  79. package/lib/type.types.d.ts +18 -0
  80. package/lib/types.d.ts +34 -25
  81. package/lib/utils/expandFn.cjs +10 -9
  82. package/lib/utils/expandFn.cjs.map +1 -1
  83. package/lib/utils/expandFn.d.ts +1 -4
  84. package/lib/utils/expandFn.js +9 -7
  85. package/lib/utils/expandFn.js.map +1 -1
  86. package/package.json +31 -32
  87. package/lib/constants.d.ts.map +0 -1
  88. package/lib/helpers/any.d.ts.map +0 -1
  89. package/lib/helpers/array.d.ts.map +0 -1
  90. package/lib/helpers/custom.d.ts.map +0 -1
  91. package/lib/helpers/index.cjs.map +0 -1
  92. package/lib/helpers/index.d.ts.map +0 -1
  93. package/lib/helpers/index.js.map +0 -1
  94. package/lib/helpers/intersection.d.ts.map +0 -1
  95. package/lib/helpers/litterals.d.ts.map +0 -1
  96. package/lib/helpers/maybe.cjs +0 -10
  97. package/lib/helpers/maybe.cjs.map +0 -1
  98. package/lib/helpers/maybe.d.ts +0 -4
  99. package/lib/helpers/maybe.d.ts.map +0 -1
  100. package/lib/helpers/maybe.js +0 -8
  101. package/lib/helpers/maybe.js.map +0 -1
  102. package/lib/helpers/partial.d.ts.map +0 -1
  103. package/lib/helpers/record.d.ts.map +0 -1
  104. package/lib/helpers/soa.d.ts.map +0 -1
  105. package/lib/helpers/sv.d.ts.map +0 -1
  106. package/lib/helpers/tuple.d.ts.map +0 -1
  107. package/lib/helpers/union.d.ts.map +0 -1
  108. package/lib/index.cjs.map +0 -1
  109. package/lib/index.d.ts.map +0 -1
  110. package/lib/index.js.map +0 -1
  111. package/lib/transform.cjs +0 -63
  112. package/lib/transform.cjs.map +0 -1
  113. package/lib/transform.d.ts +0 -3
  114. package/lib/transform.d.ts.map +0 -1
  115. package/lib/transform.js +0 -61
  116. package/lib/transform.js.map +0 -1
  117. package/lib/transform.types.d.ts +0 -18
  118. package/lib/transform.types.d.ts.map +0 -1
  119. package/lib/types.d.ts.map +0 -1
  120. package/lib/utils/expandFn.d.ts.map +0 -1
@@ -1,15 +1,14 @@
1
- 'use strict';
2
-
3
- var constants = require('../constants.cjs');
4
-
1
+ const require_constants = require("../constants.cjs");
2
+ //#region src/helpers/partial.ts
5
3
  const partial = (value) => {
6
- const entries = Object.entries(value).filter(([key]) => key !== constants.PARTIAL);
7
- const out = {};
8
- entries.forEach(([key, value]) => {
9
- out[key] = value;
10
- });
11
- return out;
4
+ const entries = Object.entries(value).filter(([key]) => key !== require_constants.PARTIAL);
5
+ const out = {};
6
+ entries.forEach(([key, value]) => {
7
+ out[key] = value;
8
+ });
9
+ return out;
12
10
  };
13
-
11
+ //#endregion
14
12
  module.exports = partial;
15
- //# sourceMappingURL=partial.cjs.map
13
+
14
+ //# sourceMappingURL=partial.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"partial.cjs","sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from '../constants';\nimport type { ObjectS, PartialCustom } from '../types';\n\nconst partial = <T extends ObjectS>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport default partial;\n"],"names":["PARTIAL"],"mappings":";;;;AAGA,MAAM,OAAO,GAAG,CAAoB,KAAQ,KAAuB;IACjE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,KAAKA,iBAAO,CAAC;IACxE,MAAM,GAAG,GAAQ,EAAE;IAEnB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAC/B,QAAA,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAClB,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,GAAG;AACZ;;;;"}
1
+ {"version":3,"file":"partial.cjs","names":["PARTIAL"],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <T extends ObjectT>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport default partial;\n"],"mappings":";;AAGA,MAAM,WAA8B,UAAgC;CAClE,MAAM,UAAU,OAAO,QAAQ,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQA,kBAAAA,QAAQ;CACxE,MAAM,MAAW,EAAE;AAEnB,SAAQ,SAAS,CAAC,KAAK,WAAW;AAChC,MAAI,OAAO;GACX;AAEF,QAAO"}
@@ -1,4 +1,3 @@
1
- import type { ObjectS, PartialCustom } from '../types';
2
- declare const partial: <T extends ObjectS>(value: T) => T & PartialCustom;
1
+ import type { ObjectT, PartialCustom } from "../types";
2
+ declare const partial: <T extends ObjectT>(value: T) => T & PartialCustom;
3
3
  export default partial;
4
- //# sourceMappingURL=partial.d.ts.map
@@ -1,13 +1,14 @@
1
- import { PARTIAL } from '../constants.js';
2
-
1
+ import { PARTIAL } from "../constants.js";
2
+ //#region src/helpers/partial.ts
3
3
  const partial = (value) => {
4
- const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);
5
- const out = {};
6
- entries.forEach(([key, value]) => {
7
- out[key] = value;
8
- });
9
- return out;
4
+ const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);
5
+ const out = {};
6
+ entries.forEach(([key, value]) => {
7
+ out[key] = value;
8
+ });
9
+ return out;
10
10
  };
11
-
11
+ //#endregion
12
12
  export { partial as default };
13
- //# sourceMappingURL=partial.js.map
13
+
14
+ //# sourceMappingURL=partial.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"partial.js","sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from '../constants';\nimport type { ObjectS, PartialCustom } from '../types';\n\nconst partial = <T extends ObjectS>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport default partial;\n"],"names":[],"mappings":";;AAGA,MAAM,OAAO,GAAG,CAAoB,KAAQ,KAAuB;IACjE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,OAAO,CAAC;IACxE,MAAM,GAAG,GAAQ,EAAE;IAEnB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAC/B,QAAA,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAClB,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,GAAG;AACZ;;;;"}
1
+ {"version":3,"file":"partial.js","names":[],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <T extends ObjectT>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport default partial;\n"],"mappings":";;AAGA,MAAM,WAA8B,UAAgC;CAClE,MAAM,UAAU,OAAO,QAAQ,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQ,QAAQ;CACxE,MAAM,MAAW,EAAE;AAEnB,SAAQ,SAAS,CAAC,KAAK,WAAW;AAChC,MAAI,OAAO;GACX;AAEF,QAAO"}
@@ -0,0 +1,10 @@
1
+ //#region src/helpers/primitiveObject.ts
2
+ const primitiveObject = require("../utils/expandFn.cjs").expandFn((value) => {
3
+ return value || {};
4
+ }, { map: (value) => {
5
+ return value || {};
6
+ } });
7
+ //#endregion
8
+ module.exports = primitiveObject;
9
+
10
+ //# sourceMappingURL=primitiveObject.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitiveObject.cjs","names":["expandFn"],"sources":["../../src/helpers/primitiveObject.ts"],"sourcesContent":["import type {\n NotReadonly,\n PrimitiveObjectMapS,\n PrimitiveObjectT,\n} from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst primitiveObject = expandFn(\n <const T extends PrimitiveObjectT = PrimitiveObjectT>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n {\n map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n },\n);\n\nexport default primitiveObject;\n"],"mappings":";AAOA,MAAM,mDAAkBA,UAEpB,UACuC;AACvC,QAAQ,SAAS,EAAE;GAErB,EACE,MACE,UACuC;AACvC,QAAQ,SAAS,EAAE;GAEtB,CACF"}
@@ -0,0 +1,5 @@
1
+ import type { NotReadonly, PrimitiveObjectMapS, PrimitiveObjectT } from "../types";
2
+ declare const primitiveObject: import("..").FnBasic<(<const T extends PrimitiveObjectT = PrimitiveObjectT>(value?: T) => Exclude<NotReadonly<T>, undefined>), {
3
+ readonly map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(value?: T) => Exclude<NotReadonly<T>, undefined>;
4
+ }>;
5
+ export default primitiveObject;
@@ -0,0 +1,11 @@
1
+ import { expandFn } from "../utils/expandFn.js";
2
+ //#region src/helpers/primitiveObject.ts
3
+ const primitiveObject = expandFn((value) => {
4
+ return value || {};
5
+ }, { map: (value) => {
6
+ return value || {};
7
+ } });
8
+ //#endregion
9
+ export { primitiveObject as default };
10
+
11
+ //# sourceMappingURL=primitiveObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitiveObject.js","names":[],"sources":["../../src/helpers/primitiveObject.ts"],"sourcesContent":["import type {\n NotReadonly,\n PrimitiveObjectMapS,\n PrimitiveObjectT,\n} from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst primitiveObject = expandFn(\n <const T extends PrimitiveObjectT = PrimitiveObjectT>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n {\n map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n },\n);\n\nexport default primitiveObject;\n"],"mappings":";;AAOA,MAAM,kBAAkB,UAEpB,UACuC;AACvC,QAAQ,SAAS,EAAE;GAErB,EACE,MACE,UACuC;AACvC,QAAQ,SAAS,EAAE;GAEtB,CACF"}
@@ -1,12 +1,11 @@
1
- 'use strict';
2
-
1
+ //#region src/helpers/record.ts
3
2
  const record = (value, ...keys) => {
4
- const object = keys.reduce((acc, key) => {
5
- acc[key] = value;
6
- return acc;
7
- }, {});
8
- return object;
3
+ return keys.reduce((acc, key) => {
4
+ acc[key] = value;
5
+ return acc;
6
+ }, {});
9
7
  };
10
-
8
+ //#endregion
11
9
  module.exports = record;
12
- //# sourceMappingURL=record.cjs.map
10
+
11
+ //# sourceMappingURL=record.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"record.cjs","sources":["../../src/helpers/record.ts"],"sourcesContent":["import type { Keys, ObjectS } from '../types';\n\nconst record = <const K extends Keys[], V extends ObjectS>(\n value: V,\n ...keys: K\n) => {\n const object = keys.reduce((acc, key) => {\n acc[key] = value;\n return acc;\n }, {} as any);\n\n return object as Record<K[number] extends never ? Keys : K[number], V>;\n};\n\nexport default record;\n"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAG,CACb,KAAQ,EACR,GAAG,IAAO,KACR;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAI;AACtC,QAAA,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAChB,QAAA,OAAO,GAAG;IACZ,CAAC,EAAE,EAAS,CAAC;AAEb,IAAA,OAAO,MAA+D;AACxE;;;;"}
1
+ {"version":3,"file":"record.cjs","names":[],"sources":["../../src/helpers/record.ts"],"sourcesContent":["import type { Keys, ObjectT } from \"../types\";\n\nconst record = <const K extends Keys[], V extends ObjectT>(\n value: V,\n ...keys: K\n) => {\n const object = keys.reduce((acc, key) => {\n acc[key] = value;\n return acc;\n }, {} as any);\n\n return object as Record<K[number] extends never ? Keys : K[number], V>;\n};\n\nexport default record;\n"],"mappings":";AAEA,MAAM,UACJ,OACA,GAAG,SACA;AAMH,QALe,KAAK,QAAQ,KAAK,QAAQ;AACvC,MAAI,OAAO;AACX,SAAO;IACN,EAAE,CAAQ"}
@@ -1,4 +1,3 @@
1
- import type { Keys, ObjectS } from '../types';
2
- declare const record: <const K extends Keys[], V extends ObjectS>(value: V, ...keys: K) => Record<K[number] extends never ? Keys : K[number], V>;
1
+ import type { Keys, ObjectT } from "../types";
2
+ declare const record: <const K extends Keys[], V extends ObjectT>(value: V, ...keys: K) => Record<K[number] extends never ? Keys : K[number], V>;
3
3
  export default record;
4
- //# sourceMappingURL=record.d.ts.map
@@ -1,10 +1,11 @@
1
+ //#region src/helpers/record.ts
1
2
  const record = (value, ...keys) => {
2
- const object = keys.reduce((acc, key) => {
3
- acc[key] = value;
4
- return acc;
5
- }, {});
6
- return object;
3
+ return keys.reduce((acc, key) => {
4
+ acc[key] = value;
5
+ return acc;
6
+ }, {});
7
7
  };
8
-
8
+ //#endregion
9
9
  export { record as default };
10
- //# sourceMappingURL=record.js.map
10
+
11
+ //# sourceMappingURL=record.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sources":["../../src/helpers/record.ts"],"sourcesContent":["import type { Keys, ObjectS } from '../types';\n\nconst record = <const K extends Keys[], V extends ObjectS>(\n value: V,\n ...keys: K\n) => {\n const object = keys.reduce((acc, key) => {\n acc[key] = value;\n return acc;\n }, {} as any);\n\n return object as Record<K[number] extends never ? Keys : K[number], V>;\n};\n\nexport default record;\n"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,CACb,KAAQ,EACR,GAAG,IAAO,KACR;IACF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAI;AACtC,QAAA,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK;AAChB,QAAA,OAAO,GAAG;IACZ,CAAC,EAAE,EAAS,CAAC;AAEb,IAAA,OAAO,MAA+D;AACxE;;;;"}
1
+ {"version":3,"file":"record.js","names":[],"sources":["../../src/helpers/record.ts"],"sourcesContent":["import type { Keys, ObjectT } from \"../types\";\n\nconst record = <const K extends Keys[], V extends ObjectT>(\n value: V,\n ...keys: K\n) => {\n const object = keys.reduce((acc, key) => {\n acc[key] = value;\n return acc;\n }, {} as any);\n\n return object as Record<K[number] extends never ? Keys : K[number], V>;\n};\n\nexport default record;\n"],"mappings":";AAEA,MAAM,UACJ,OACA,GAAG,SACA;AAMH,QALe,KAAK,QAAQ,KAAK,QAAQ;AACvC,MAAI,OAAO;AACX,SAAO;IACN,EAAE,CAAQ"}
@@ -1,10 +1,9 @@
1
- 'use strict';
2
-
3
- var constants = require('../constants.cjs');
4
-
1
+ const require_constants = require("../constants.cjs");
2
+ //#region src/helpers/soa.ts
5
3
  const soa = (value) => {
6
- return { [constants.SOA]: value };
4
+ return { [require_constants.SOA]: value };
7
5
  };
8
-
6
+ //#endregion
9
7
  module.exports = soa;
10
- //# sourceMappingURL=soa.cjs.map
8
+
9
+ //# sourceMappingURL=soa.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"soa.cjs","sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from '../constants';\nimport type { NotReadonly, ObjectS, SoaCustom } from '../types';\n\nconst soa = <const T extends ObjectS>(value: T) => {\n type Out = SoaCustom<Extract<NotReadonly<T>, ObjectS>>;\n return { [SOA]: value } as Out;\n};\n\nexport default soa;\n"],"names":["SOA"],"mappings":";;;;AAGA,MAAM,GAAG,GAAG,CAA0B,KAAQ,KAAI;AAEhD,IAAA,OAAO,EAAE,CAACA,aAAG,GAAG,KAAK,EAAS;AAChC;;;;"}
1
+ {"version":3,"file":"soa.cjs","names":["SOA"],"sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from \"../constants\";\nimport type { NotReadonly, ObjectT, SoaCustom } from \"../types\";\n\nconst soa = <const T extends ObjectT>(value: T) => {\n type Out = SoaCustom<Extract<NotReadonly<T>, ObjectT>>;\n return { [SOA]: value } as Out;\n};\n\nexport default soa;\n"],"mappings":";;AAGA,MAAM,OAAgC,UAAa;AAEjD,QAAO,GAAGA,kBAAAA,MAAM,OAAO"}
@@ -1,4 +1,3 @@
1
- import type { NotReadonly, ObjectS, SoaCustom } from '../types';
2
- declare const soa: <const T extends ObjectS>(value: T) => SoaCustom<Extract<NotReadonly<T>, ObjectS>>;
1
+ import type { NotReadonly, ObjectT, SoaCustom } from "../types";
2
+ declare const soa: <const T extends ObjectT>(value: T) => SoaCustom<Extract<NotReadonly<T>, ObjectT>>;
3
3
  export default soa;
4
- //# sourceMappingURL=soa.d.ts.map
@@ -1,8 +1,9 @@
1
- import { SOA } from '../constants.js';
2
-
1
+ import { SOA } from "../constants.js";
2
+ //#region src/helpers/soa.ts
3
3
  const soa = (value) => {
4
- return { [SOA]: value };
4
+ return { [SOA]: value };
5
5
  };
6
-
6
+ //#endregion
7
7
  export { soa as default };
8
- //# sourceMappingURL=soa.js.map
8
+
9
+ //# sourceMappingURL=soa.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"soa.js","sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from '../constants';\nimport type { NotReadonly, ObjectS, SoaCustom } from '../types';\n\nconst soa = <const T extends ObjectS>(value: T) => {\n type Out = SoaCustom<Extract<NotReadonly<T>, ObjectS>>;\n return { [SOA]: value } as Out;\n};\n\nexport default soa;\n"],"names":[],"mappings":";;AAGA,MAAM,GAAG,GAAG,CAA0B,KAAQ,KAAI;AAEhD,IAAA,OAAO,EAAE,CAAC,GAAG,GAAG,KAAK,EAAS;AAChC;;;;"}
1
+ {"version":3,"file":"soa.js","names":[],"sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from \"../constants\";\nimport type { NotReadonly, ObjectT, SoaCustom } from \"../types\";\n\nconst soa = <const T extends ObjectT>(value: T) => {\n type Out = SoaCustom<Extract<NotReadonly<T>, ObjectT>>;\n return { [SOA]: value } as Out;\n};\n\nexport default soa;\n"],"mappings":";;AAGA,MAAM,OAAgC,UAAa;AAEjD,QAAO,GAAG,MAAM,OAAO"}
@@ -1,6 +1,6 @@
1
- 'use strict';
2
-
1
+ //#region src/helpers/sv.ts
3
2
  const sv = {};
4
-
3
+ //#endregion
5
4
  module.exports = sv;
6
- //# sourceMappingURL=sv.cjs.map
5
+
6
+ //# sourceMappingURL=sv.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"sv.cjs","sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from '../types';\n\nconst sv = {} as Custom<StateValue>;\nexport default sv;\n"],"names":[],"mappings":";;AAEA,MAAM,EAAE,GAAG;;;;"}
1
+ {"version":3,"file":"sv.cjs","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from '../types';\n\nconst sv = {} as Custom<StateValue>;\nexport default sv;\n"],"mappings":";AAEA,MAAM,KAAK,EAAE"}
@@ -1,4 +1,3 @@
1
1
  import type { Custom, StateValue } from '../types';
2
2
  declare const sv: Custom<StateValue>;
3
3
  export default sv;
4
- //# sourceMappingURL=sv.d.ts.map
package/lib/helpers/sv.js CHANGED
@@ -1,4 +1,6 @@
1
+ //#region src/helpers/sv.ts
1
2
  const sv = {};
2
-
3
+ //#endregion
3
4
  export { sv as default };
4
- //# sourceMappingURL=sv.js.map
5
+
6
+ //# sourceMappingURL=sv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sv.js","sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from '../types';\n\nconst sv = {} as Custom<StateValue>;\nexport default sv;\n"],"names":[],"mappings":"AAEA,MAAM,EAAE,GAAG;;;;"}
1
+ {"version":3,"file":"sv.js","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from '../types';\n\nconst sv = {} as Custom<StateValue>;\nexport default sv;\n"],"mappings":";AAEA,MAAM,KAAK,EAAE"}
@@ -1,6 +1,6 @@
1
- 'use strict';
2
-
1
+ //#region src/helpers/tuple.ts
3
2
  const tuple = (...values) => values;
4
-
3
+ //#endregion
5
4
  module.exports = tuple;
6
- //# sourceMappingURL=tuple.cjs.map
5
+
6
+ //# sourceMappingURL=tuple.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tuple.cjs","sources":["../../src/helpers/tuple.ts"],"sourcesContent":["import type { __ObjectS, ArrayCustom, NotReadonly, Maybe } from '../types';\n\nconst tuple = <\n const T extends [\n __ObjectS | Maybe | ArrayCustom,\n __ObjectS | Maybe | ArrayCustom,\n ...(__ObjectS | Maybe | ArrayCustom)[],\n ],\n>(\n ...values: T\n) => values as NotReadonly<T>;\n\nexport default tuple;\n"],"names":[],"mappings":";;AAEA,MAAM,KAAK,GAAG,CAOZ,GAAG,MAAS,KACT;;;;"}
1
+ {"version":3,"file":"tuple.cjs","names":[],"sources":["../../src/helpers/tuple.ts"],"sourcesContent":["import type { NotReadonly, ObjectT } from \"../types\";\n\nconst tuple = <const T extends [ObjectT, ...ObjectT[]]>(...values: T) =>\n values as NotReadonly<T>;\n\nexport default tuple;\n"],"mappings":";AAEA,MAAM,SAAkD,GAAG,WACzD"}
@@ -1,4 +1,3 @@
1
- import type { __ObjectS, ArrayCustom, NotReadonly, Maybe } from '../types';
2
- declare const tuple: <const T extends [__ObjectS | Maybe | ArrayCustom, __ObjectS | Maybe | ArrayCustom, ...(__ObjectS | Maybe | ArrayCustom)[]]>(...values: T) => NotReadonly<T>;
1
+ import type { NotReadonly, ObjectT } from "../types";
2
+ declare const tuple: <const T extends [ObjectT, ...ObjectT[]]>(...values: T) => NotReadonly<T>;
3
3
  export default tuple;
4
- //# sourceMappingURL=tuple.d.ts.map
@@ -1,4 +1,6 @@
1
+ //#region src/helpers/tuple.ts
1
2
  const tuple = (...values) => values;
2
-
3
+ //#endregion
3
4
  export { tuple as default };
4
- //# sourceMappingURL=tuple.js.map
5
+
6
+ //# sourceMappingURL=tuple.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tuple.js","sources":["../../src/helpers/tuple.ts"],"sourcesContent":["import type { __ObjectS, ArrayCustom, NotReadonly, Maybe } from '../types';\n\nconst tuple = <\n const T extends [\n __ObjectS | Maybe | ArrayCustom,\n __ObjectS | Maybe | ArrayCustom,\n ...(__ObjectS | Maybe | ArrayCustom)[],\n ],\n>(\n ...values: T\n) => values as NotReadonly<T>;\n\nexport default tuple;\n"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAG,CAOZ,GAAG,MAAS,KACT;;;;"}
1
+ {"version":3,"file":"tuple.js","names":[],"sources":["../../src/helpers/tuple.ts"],"sourcesContent":["import type { NotReadonly, ObjectT } from \"../types\";\n\nconst tuple = <const T extends [ObjectT, ...ObjectT[]]>(...values: T) =>\n values as NotReadonly<T>;\n\nexport default tuple;\n"],"mappings":";AAEA,MAAM,SAAkD,GAAG,WACzD"}
@@ -1,13 +1,10 @@
1
- 'use strict';
2
-
3
- var utils_expandFn = require('../utils/expandFn.cjs');
4
-
1
+ const require_utils_expandFn = require("../utils/expandFn.cjs");
2
+ //#region src/helpers/union.ts
5
3
  const union = (...values) => {
6
- return values[0];
4
+ return values[0];
7
5
  };
8
- const fn = utils_expandFn.expandFn(union, {
9
- discriminated: (_key, ...values) => union(...values),
10
- });
11
-
6
+ const fn = require_utils_expandFn.expandFn(union, { discriminated: (_key, ...values) => union(...values) });
7
+ //#endregion
12
8
  module.exports = fn;
13
- //# sourceMappingURL=union.cjs.map
9
+
10
+ //# sourceMappingURL=union.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"union.cjs","sources":["../../src/helpers/union.ts"],"sourcesContent":["import type { Keys, ObjectMapS, ObjectS } from '../types';\nimport { expandFn } from '../utils/expandFn';\n\nconst union = <T extends [ObjectS, ObjectS, ...ObjectS[]]>(\n ...values: T\n) => {\n return values[0] as T[number];\n};\n\ntype Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectS>;\n\nconst fn = expandFn(union, {\n discriminated: <\n const K extends Keys,\n T extends [Discriminated<K>, Discriminated<K>, ...Discriminated<K>[]],\n >(\n _key: K,\n ...values: T\n ) => union(...values),\n});\n\nexport default fn;\n"],"names":["expandFn"],"mappings":";;;;AAGA,MAAM,KAAK,GAAG,CACZ,GAAG,MAAS,KACV;AACF,IAAA,OAAO,MAAM,CAAC,CAAC,CAAc;AAC/B,CAAC;AAID,MAAM,EAAE,GAAGA,uBAAQ,CAAC,KAAK,EAAE;AACzB,IAAA,aAAa,EAAE,CAIb,IAAO,EACP,GAAG,MAAS,KACT,KAAK,CAAC,GAAG,MAAM,CAAC;AACtB,CAAA;;;;"}
1
+ {"version":3,"file":"union.cjs","names":["expandFn"],"sources":["../../src/helpers/union.ts"],"sourcesContent":["import type { Keys, ObjectMapS, ObjectT } from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst union = <T extends [ObjectT, ObjectT, ...ObjectT[]]>(...values: T) => {\n return values[0] as T[number];\n};\n\ntype Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectT>;\n\nconst fn = expandFn(union, {\n discriminated: <\n const K extends Keys,\n T extends [Discriminated<K>, Discriminated<K>, ...Discriminated<K>[]],\n >(\n _key: K,\n ...values: T\n ) => union(...values),\n});\n\nexport default fn;\n"],"mappings":";;AAGA,MAAM,SAAqD,GAAG,WAAc;AAC1E,QAAO,OAAO;;AAKhB,MAAM,KAAKA,uBAAAA,SAAS,OAAO,EACzB,gBAIE,MACA,GAAG,WACA,MAAM,GAAG,OAAO,EACtB,CAAC"}
@@ -1,7 +1,6 @@
1
- import type { Keys, ObjectMapS, ObjectS } from '../types';
2
- type Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectS>;
3
- declare const fn: {
1
+ import type { Keys, ObjectMapS, ObjectT } from "../types";
2
+ type Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectT>;
3
+ declare const fn: import("..").FnBasic<(<T extends [ObjectT, ObjectT, ...ObjectT[]]>(...values: T) => T[number]), {
4
4
  readonly discriminated: <const K extends Keys, T extends [Discriminated<K>, Discriminated<K>, ...Discriminated<K>[]]>(_key: K, ...values: T) => T[number];
5
- } & (<T extends [ObjectS, ObjectS, ...ObjectS[]]>(...values: T) => T[number]);
5
+ }>;
6
6
  export default fn;
7
- //# sourceMappingURL=union.d.ts.map
@@ -1,11 +1,10 @@
1
- import { expandFn } from '../utils/expandFn.js';
2
-
1
+ import { expandFn } from "../utils/expandFn.js";
2
+ //#region src/helpers/union.ts
3
3
  const union = (...values) => {
4
- return values[0];
4
+ return values[0];
5
5
  };
6
- const fn = expandFn(union, {
7
- discriminated: (_key, ...values) => union(...values),
8
- });
9
-
6
+ const fn = expandFn(union, { discriminated: (_key, ...values) => union(...values) });
7
+ //#endregion
10
8
  export { fn as default };
11
- //# sourceMappingURL=union.js.map
9
+
10
+ //# sourceMappingURL=union.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"union.js","sources":["../../src/helpers/union.ts"],"sourcesContent":["import type { Keys, ObjectMapS, ObjectS } from '../types';\nimport { expandFn } from '../utils/expandFn';\n\nconst union = <T extends [ObjectS, ObjectS, ...ObjectS[]]>(\n ...values: T\n) => {\n return values[0] as T[number];\n};\n\ntype Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectS>;\n\nconst fn = expandFn(union, {\n discriminated: <\n const K extends Keys,\n T extends [Discriminated<K>, Discriminated<K>, ...Discriminated<K>[]],\n >(\n _key: K,\n ...values: T\n ) => union(...values),\n});\n\nexport default fn;\n"],"names":[],"mappings":";;AAGA,MAAM,KAAK,GAAG,CACZ,GAAG,MAAS,KACV;AACF,IAAA,OAAO,MAAM,CAAC,CAAC,CAAc;AAC/B,CAAC;AAID,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE;AACzB,IAAA,aAAa,EAAE,CAIb,IAAO,EACP,GAAG,MAAS,KACT,KAAK,CAAC,GAAG,MAAM,CAAC;AACtB,CAAA;;;;"}
1
+ {"version":3,"file":"union.js","names":[],"sources":["../../src/helpers/union.ts"],"sourcesContent":["import type { Keys, ObjectMapS, ObjectT } from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst union = <T extends [ObjectT, ObjectT, ...ObjectT[]]>(...values: T) => {\n return values[0] as T[number];\n};\n\ntype Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectT>;\n\nconst fn = expandFn(union, {\n discriminated: <\n const K extends Keys,\n T extends [Discriminated<K>, Discriminated<K>, ...Discriminated<K>[]],\n >(\n _key: K,\n ...values: T\n ) => union(...values),\n});\n\nexport default fn;\n"],"mappings":";;AAGA,MAAM,SAAqD,GAAG,WAAc;AAC1E,QAAO,OAAO;;AAKhB,MAAM,KAAK,SAAS,OAAO,EACzB,gBAIE,MACA,GAAG,WACA,MAAM,GAAG,OAAO,EACtB,CAAC"}
package/lib/index.cjs CHANGED
@@ -1,40 +1,40 @@
1
- 'use strict';
2
-
3
- var constants = require('./constants.cjs');
4
- var helpers_any = require('./helpers/any.cjs');
5
- var helpers_array = require('./helpers/array.cjs');
6
- var helpers_custom = require('./helpers/custom.cjs');
7
- var helpers_intersection = require('./helpers/intersection.cjs');
8
- var helpers_litterals = require('./helpers/litterals.cjs');
9
- var helpers_maybe = require('./helpers/maybe.cjs');
10
- var helpers_partial = require('./helpers/partial.cjs');
11
- var helpers_record = require('./helpers/record.cjs');
12
- var helpers_soa = require('./helpers/soa.cjs');
13
- var helpers_sv = require('./helpers/sv.cjs');
14
- var helpers_tuple = require('./helpers/tuple.cjs');
15
- var helpers_union = require('./helpers/union.cjs');
16
- var transform = require('./transform.cjs');
17
-
18
-
19
-
20
- exports.ARRAY = constants.ARRAY;
21
- exports.CUSTOM = constants.CUSTOM;
22
- exports.MAYBE = constants.MAYBE;
23
- exports.PARTIAL = constants.PARTIAL;
24
- exports.PRIMITIVES = constants.PRIMITIVES;
25
- exports.PRIMITIVE_OBJECTS = constants.PRIMITIVE_OBJECTS;
26
- exports.SOA = constants.SOA;
27
- exports.any = helpers_any;
28
- exports.array = helpers_array;
29
- exports.custom = helpers_custom;
30
- exports.intersection = helpers_intersection;
31
- exports.litterals = helpers_litterals;
32
- exports.maybe = helpers_maybe;
33
- exports.partial = helpers_partial;
34
- exports.record = helpers_record;
35
- exports.soa = helpers_soa;
36
- exports.sv = helpers_sv;
37
- exports.tuple = helpers_tuple;
38
- exports.union = helpers_union;
39
- exports.transform = transform.transform;
40
- //# sourceMappingURL=index.cjs.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types = require("./types.cjs");
3
+ const require_constants = require("./constants.cjs");
4
+ const require_helpers_any = require("./helpers/any.cjs");
5
+ const require_helpers_array = require("./helpers/array.cjs");
6
+ const require_helpers_custom = require("./helpers/custom.cjs");
7
+ const require_helpers_intersection = require("./helpers/intersection.cjs");
8
+ const require_helpers_litterals = require("./helpers/litterals.cjs");
9
+ const require_helpers_optional = require("./helpers/optional.cjs");
10
+ const require_helpers_partial = require("./helpers/partial.cjs");
11
+ const require_helpers_record = require("./helpers/record.cjs");
12
+ const require_helpers_soa = require("./helpers/soa.cjs");
13
+ const require_helpers_sv = require("./helpers/sv.cjs");
14
+ const require_helpers_tuple = require("./helpers/tuple.cjs");
15
+ const require_helpers_union = require("./helpers/union.cjs");
16
+ const require_helpers_primitiveObject = require("./helpers/primitiveObject.cjs");
17
+ require("./helpers/index.cjs");
18
+ const require_type = require("./type.cjs");
19
+ exports.ARRAY = require_constants.ARRAY;
20
+ exports.CUSTOM = require_constants.CUSTOM;
21
+ exports.OPTIONAL = require_constants.OPTIONAL;
22
+ exports.OptionalHelperClass = require_types.OptionalHelperClass;
23
+ exports.PARTIAL = require_constants.PARTIAL;
24
+ exports.PRIMITIVES = require_constants.PRIMITIVES;
25
+ exports.PRIMITIVE_OBJECTS = require_constants.PRIMITIVE_OBJECTS;
26
+ exports.SOA = require_constants.SOA;
27
+ exports.any = require_helpers_any;
28
+ exports.array = require_helpers_array;
29
+ exports.custom = require_helpers_custom;
30
+ exports.intersection = require_helpers_intersection;
31
+ exports.litterals = require_helpers_litterals;
32
+ exports.optional = require_helpers_optional;
33
+ exports.partial = require_helpers_partial;
34
+ exports.primitiveObject = require_helpers_primitiveObject;
35
+ exports.record = require_helpers_record;
36
+ exports.soa = require_helpers_soa;
37
+ exports.sv = require_helpers_sv;
38
+ exports.tuple = require_helpers_tuple;
39
+ exports.type = require_type.type;
40
+ exports.union = require_helpers_union;
package/lib/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './constants';
2
2
  export * from './helpers';
3
- export * from './transform';
3
+ export * from './type';
4
4
  export * from './types';
5
- //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,15 +1,18 @@
1
- export { ARRAY, CUSTOM, MAYBE, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA } from './constants.js';
2
- export { default as any } from './helpers/any.js';
3
- export { default as array } from './helpers/array.js';
4
- export { default as custom } from './helpers/custom.js';
5
- export { default as intersection } from './helpers/intersection.js';
6
- export { default as litterals } from './helpers/litterals.js';
7
- export { default as maybe } from './helpers/maybe.js';
8
- export { default as partial } from './helpers/partial.js';
9
- export { default as record } from './helpers/record.js';
10
- export { default as soa } from './helpers/soa.js';
11
- export { default as sv } from './helpers/sv.js';
12
- export { default as tuple } from './helpers/tuple.js';
13
- export { default as union } from './helpers/union.js';
14
- export { transform } from './transform.js';
15
- //# sourceMappingURL=index.js.map
1
+ import { OptionalHelperClass } from "./types.js";
2
+ import { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA } from "./constants.js";
3
+ import any from "./helpers/any.js";
4
+ import array from "./helpers/array.js";
5
+ import custom from "./helpers/custom.js";
6
+ import intersection from "./helpers/intersection.js";
7
+ import litterals from "./helpers/litterals.js";
8
+ import optional from "./helpers/optional.js";
9
+ import partial from "./helpers/partial.js";
10
+ import record from "./helpers/record.js";
11
+ import soa from "./helpers/soa.js";
12
+ import sv from "./helpers/sv.js";
13
+ import tuple from "./helpers/tuple.js";
14
+ import fn from "./helpers/union.js";
15
+ import primitiveObject from "./helpers/primitiveObject.js";
16
+ import "./helpers/index.js";
17
+ import { type } from "./type.js";
18
+ export { ARRAY, CUSTOM, OPTIONAL, OptionalHelperClass, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, any, array, custom, intersection, litterals, optional, partial, primitiveObject, record, soa, sv, tuple, type, fn as union };
package/lib/type.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { Transform_F } from "./type.types";
2
+ export declare const type: Transform_F;
@@ -0,0 +1,18 @@
1
+ import type { any, array, custom, intersection, litterals, optional, partial, primitiveObject, record, soa, sv, tuple, union } from "./helpers";
2
+ import type { inferT, ObjectT } from "./types";
3
+ export type Helpers = {
4
+ any: typeof any;
5
+ custom: typeof custom;
6
+ intersection: typeof intersection;
7
+ litterals: typeof litterals;
8
+ optional: typeof optional;
9
+ partial: typeof partial;
10
+ record: typeof record;
11
+ soa: typeof soa;
12
+ sv: typeof sv;
13
+ union: typeof union;
14
+ array: typeof array;
15
+ tuple: typeof tuple;
16
+ primitiveObject: typeof primitiveObject;
17
+ };
18
+ export type Transform_F = <T extends ObjectT = ObjectT>(option?: ((helpers: Helpers) => T) | T) => inferT<T>;