@duplojs/utils 1.2.17 → 1.2.19

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 (245) hide show
  1. package/dist/array/chunk.cjs +16 -0
  2. package/dist/array/chunk.d.ts +2 -0
  3. package/dist/array/chunk.mjs +14 -0
  4. package/dist/array/every.cjs +6 -3
  5. package/dist/array/every.d.ts +4 -3
  6. package/dist/array/every.mjs +6 -3
  7. package/dist/array/fill/all.d.ts +2 -2
  8. package/dist/array/filter.cjs +6 -3
  9. package/dist/array/filter.d.ts +6 -5
  10. package/dist/array/filter.mjs +6 -3
  11. package/dist/array/flatMap.cjs +6 -3
  12. package/dist/array/flatMap.d.ts +4 -3
  13. package/dist/array/flatMap.mjs +6 -3
  14. package/dist/array/index.cjs +13 -10
  15. package/dist/array/index.d.ts +3 -0
  16. package/dist/array/index.mjs +5 -4
  17. package/dist/array/insert.cjs +12 -0
  18. package/dist/array/insert.d.ts +2 -0
  19. package/dist/array/insert.mjs +10 -0
  20. package/dist/array/isLastIndex.cjs +12 -0
  21. package/dist/array/isLastIndex.d.ts +2 -0
  22. package/dist/array/isLastIndex.mjs +10 -0
  23. package/dist/array/map.cjs +6 -3
  24. package/dist/array/map.d.ts +4 -3
  25. package/dist/array/map.mjs +6 -3
  26. package/dist/array/push.cjs +3 -3
  27. package/dist/array/push.d.ts +2 -2
  28. package/dist/array/push.mjs +3 -3
  29. package/dist/array/reduce.cjs +22 -9
  30. package/dist/array/reduce.d.ts +7 -4
  31. package/dist/array/reduce.mjs +22 -10
  32. package/dist/array/reduceRight.cjs +7 -10
  33. package/dist/array/reduceRight.d.ts +2 -2
  34. package/dist/array/reduceRight.mjs +7 -10
  35. package/dist/array/some.cjs +6 -3
  36. package/dist/array/some.d.ts +4 -3
  37. package/dist/array/some.mjs +6 -3
  38. package/dist/array/types/ArrayCoalescing.d.ts +1 -1
  39. package/dist/clean/constraint/base.cjs +77 -0
  40. package/dist/clean/constraint/base.d.ts +36 -0
  41. package/dist/clean/constraint/base.mjs +72 -0
  42. package/dist/{array/sort → clean/constraint/defaultConstraint}/index.d.ts +0 -1
  43. package/dist/clean/constraint/defaultConstraint/number.cjs +15 -0
  44. package/dist/clean/constraint/defaultConstraint/number.d.ts +8 -0
  45. package/dist/clean/constraint/defaultConstraint/number.mjs +11 -0
  46. package/dist/clean/constraint/defaultConstraint/string.cjs +12 -0
  47. package/dist/clean/constraint/defaultConstraint/string.d.ts +6 -0
  48. package/dist/clean/constraint/defaultConstraint/string.mjs +9 -0
  49. package/dist/clean/constraint/index.d.ts +2 -0
  50. package/dist/clean/entity.cjs +125 -0
  51. package/dist/clean/entity.d.ts +74 -0
  52. package/dist/clean/entity.mjs +121 -0
  53. package/dist/clean/flag.cjs +26 -0
  54. package/dist/clean/flag.d.ts +16 -0
  55. package/dist/clean/flag.mjs +23 -0
  56. package/dist/clean/index.cjs +84 -0
  57. package/dist/clean/index.d.ts +8 -0
  58. package/dist/clean/index.mjs +29 -0
  59. package/dist/clean/kind.cjs +9 -0
  60. package/dist/clean/kind.d.ts +1 -0
  61. package/dist/clean/kind.mjs +7 -0
  62. package/dist/clean/newType.cjs +91 -0
  63. package/dist/clean/newType.d.ts +38 -0
  64. package/dist/clean/newType.mjs +86 -0
  65. package/dist/clean/primitive/base.cjs +72 -0
  66. package/dist/clean/primitive/base.d.ts +36 -0
  67. package/dist/clean/primitive/base.mjs +64 -0
  68. package/dist/clean/primitive/index.d.ts +2 -0
  69. package/dist/clean/primitive/operations/date/dateGreaterThan.cjs +15 -0
  70. package/dist/clean/primitive/operations/date/dateGreaterThan.d.ts +4 -0
  71. package/dist/clean/primitive/operations/date/dateGreaterThan.mjs +13 -0
  72. package/dist/clean/primitive/operations/date/dateLessThan.cjs +15 -0
  73. package/dist/clean/primitive/operations/date/dateLessThan.d.ts +4 -0
  74. package/dist/clean/primitive/operations/date/dateLessThan.mjs +13 -0
  75. package/dist/clean/primitive/operations/date/dateMax.cjs +15 -0
  76. package/dist/clean/primitive/operations/date/dateMax.d.ts +5 -0
  77. package/dist/clean/primitive/operations/date/dateMax.mjs +13 -0
  78. package/dist/clean/primitive/operations/date/dateMin.cjs +15 -0
  79. package/dist/clean/primitive/operations/date/dateMin.d.ts +5 -0
  80. package/dist/clean/primitive/operations/date/dateMin.mjs +13 -0
  81. package/dist/clean/primitive/operations/date/index.d.ts +8 -0
  82. package/dist/clean/primitive/operations/equal.cjs +14 -0
  83. package/dist/clean/primitive/operations/equal.d.ts +4 -0
  84. package/dist/clean/primitive/operations/equal.mjs +12 -0
  85. package/dist/clean/primitive/operations/index.d.ts +5 -0
  86. package/dist/clean/primitive/operations/number/add.cjs +15 -0
  87. package/dist/clean/primitive/operations/number/add.d.ts +3 -0
  88. package/dist/clean/primitive/operations/number/add.mjs +13 -0
  89. package/dist/clean/primitive/operations/number/divide.cjs +15 -0
  90. package/dist/clean/primitive/operations/number/divide.d.ts +3 -0
  91. package/dist/clean/primitive/operations/number/divide.mjs +13 -0
  92. package/dist/clean/primitive/operations/number/greaterThan.cjs +14 -0
  93. package/dist/clean/primitive/operations/number/greaterThan.d.ts +3 -0
  94. package/dist/clean/primitive/operations/number/greaterThan.mjs +12 -0
  95. package/dist/clean/primitive/operations/number/index.d.ts +8 -0
  96. package/dist/clean/primitive/operations/number/lessThan.cjs +14 -0
  97. package/dist/clean/primitive/operations/number/lessThan.d.ts +3 -0
  98. package/dist/clean/primitive/operations/number/lessThan.mjs +12 -0
  99. package/dist/clean/primitive/operations/number/max.cjs +10 -0
  100. package/dist/clean/primitive/operations/number/max.d.ts +3 -0
  101. package/dist/clean/primitive/operations/number/max.mjs +8 -0
  102. package/dist/clean/primitive/operations/number/min.cjs +10 -0
  103. package/dist/clean/primitive/operations/number/min.d.ts +3 -0
  104. package/dist/clean/primitive/operations/number/min.mjs +8 -0
  105. package/dist/clean/primitive/operations/number/multiply.cjs +15 -0
  106. package/dist/clean/primitive/operations/number/multiply.d.ts +3 -0
  107. package/dist/clean/primitive/operations/number/multiply.mjs +13 -0
  108. package/dist/clean/primitive/operations/number/subtract.cjs +15 -0
  109. package/dist/clean/primitive/operations/number/subtract.d.ts +3 -0
  110. package/dist/clean/primitive/operations/number/subtract.mjs +13 -0
  111. package/dist/clean/primitive/operations/sort.cjs +35 -0
  112. package/dist/clean/primitive/operations/sort.d.ts +9 -0
  113. package/dist/clean/primitive/operations/sort.mjs +33 -0
  114. package/dist/clean/primitive/operations/string/concat.cjs +16 -0
  115. package/dist/clean/primitive/operations/string/concat.d.ts +3 -0
  116. package/dist/clean/primitive/operations/string/concat.mjs +14 -0
  117. package/dist/clean/primitive/operations/string/index.d.ts +5 -0
  118. package/dist/clean/primitive/operations/string/length.cjs +10 -0
  119. package/dist/clean/primitive/operations/string/length.d.ts +2 -0
  120. package/dist/clean/primitive/operations/string/length.mjs +8 -0
  121. package/dist/clean/primitive/operations/string/lengthEqual.cjs +14 -0
  122. package/dist/clean/primitive/operations/string/lengthEqual.d.ts +3 -0
  123. package/dist/clean/primitive/operations/string/lengthEqual.mjs +12 -0
  124. package/dist/clean/primitive/operations/string/lengthGreaterThan.cjs +14 -0
  125. package/dist/clean/primitive/operations/string/lengthGreaterThan.d.ts +3 -0
  126. package/dist/clean/primitive/operations/string/lengthGreaterThan.mjs +12 -0
  127. package/dist/clean/primitive/operations/string/lengthLessThan.cjs +14 -0
  128. package/dist/clean/primitive/operations/string/lengthLessThan.d.ts +3 -0
  129. package/dist/clean/primitive/operations/string/lengthLessThan.mjs +12 -0
  130. package/dist/clean/repository.cjs +15 -0
  131. package/dist/clean/repository.d.ts +8 -0
  132. package/dist/clean/repository.mjs +12 -0
  133. package/dist/clean/useCase.cjs +25 -0
  134. package/dist/clean/useCase.d.ts +23 -0
  135. package/dist/clean/useCase.mjs +21 -0
  136. package/dist/common/index.d.ts +0 -1
  137. package/dist/common/kind.d.ts +1 -0
  138. package/dist/common/types/index.d.ts +1 -0
  139. package/dist/common/types/sortType.d.ts +1 -0
  140. package/dist/common/unwrap.d.ts +1 -2
  141. package/dist/dataParser/base.d.ts +5 -4
  142. package/dist/dataParser/baseExtended.d.ts +4 -4
  143. package/dist/dataParser/extended/array.d.ts +3 -3
  144. package/dist/dataParser/extended/bigint.d.ts +2 -2
  145. package/dist/dataParser/extended/boolean.d.ts +2 -2
  146. package/dist/dataParser/extended/date.d.ts +3 -2
  147. package/dist/dataParser/extended/empty.d.ts +2 -2
  148. package/dist/dataParser/extended/lazy.d.ts +3 -3
  149. package/dist/dataParser/extended/literal.d.ts +2 -2
  150. package/dist/dataParser/extended/nil.d.ts +2 -2
  151. package/dist/dataParser/extended/nullable.d.ts +3 -3
  152. package/dist/dataParser/extended/number.cjs +3 -0
  153. package/dist/dataParser/extended/number.d.ts +5 -2
  154. package/dist/dataParser/extended/number.mjs +3 -0
  155. package/dist/dataParser/extended/object.cjs +8 -13
  156. package/dist/dataParser/extended/object.d.ts +4 -2
  157. package/dist/dataParser/extended/object.mjs +8 -13
  158. package/dist/dataParser/extended/optional.d.ts +3 -3
  159. package/dist/dataParser/extended/pipe.d.ts +3 -3
  160. package/dist/dataParser/extended/record.d.ts +3 -3
  161. package/dist/dataParser/extended/recover.d.ts +3 -3
  162. package/dist/dataParser/extended/string.d.ts +2 -2
  163. package/dist/dataParser/extended/templateLiteral.d.ts +2 -2
  164. package/dist/dataParser/extended/transform.d.ts +3 -3
  165. package/dist/dataParser/extended/tuple.d.ts +3 -3
  166. package/dist/dataParser/extended/union.d.ts +3 -3
  167. package/dist/dataParser/extended/unknown.d.ts +2 -2
  168. package/dist/dataParser/identifier.d.ts +10 -160
  169. package/dist/dataParser/index.cjs +4 -0
  170. package/dist/dataParser/index.mjs +2 -0
  171. package/dist/dataParser/parsers/array/index.cjs +2 -2
  172. package/dist/dataParser/parsers/array/index.mjs +2 -2
  173. package/dist/dataParser/parsers/literal.d.ts +1 -1
  174. package/dist/dataParser/parsers/object/index.cjs +3 -3
  175. package/dist/dataParser/parsers/object/index.d.ts +2 -0
  176. package/dist/dataParser/parsers/object/index.mjs +3 -3
  177. package/dist/dataParser/parsers/object/partial.cjs +20 -0
  178. package/dist/dataParser/parsers/object/partial.d.ts +14 -0
  179. package/dist/dataParser/parsers/object/partial.mjs +18 -0
  180. package/dist/dataParser/parsers/object/required.cjs +20 -0
  181. package/dist/dataParser/parsers/object/required.d.ts +10 -0
  182. package/dist/dataParser/parsers/object/required.mjs +18 -0
  183. package/dist/dataParser/parsers/record/index.cjs +2 -2
  184. package/dist/dataParser/parsers/record/index.mjs +2 -2
  185. package/dist/dataParser/parsers/refine.d.ts +1 -1
  186. package/dist/dataParser/parsers/tuple.cjs +2 -2
  187. package/dist/dataParser/parsers/tuple.mjs +2 -2
  188. package/dist/date/index.cjs +8 -0
  189. package/dist/date/index.d.ts +4 -0
  190. package/dist/date/index.mjs +4 -0
  191. package/dist/date/is.cjs +9 -0
  192. package/dist/date/is.d.ts +2 -0
  193. package/dist/date/is.mjs +7 -0
  194. package/dist/date/max.cjs +10 -0
  195. package/dist/date/max.d.ts +3 -0
  196. package/dist/date/max.mjs +8 -0
  197. package/dist/date/min.cjs +10 -0
  198. package/dist/date/min.d.ts +3 -0
  199. package/dist/date/min.mjs +8 -0
  200. package/dist/date/sort.cjs +20 -0
  201. package/dist/date/sort.d.ts +4 -0
  202. package/dist/date/sort.mjs +18 -0
  203. package/dist/generator/chunk.cjs +24 -0
  204. package/dist/generator/chunk.d.ts +2 -0
  205. package/dist/generator/chunk.mjs +22 -0
  206. package/dist/generator/index.cjs +2 -0
  207. package/dist/generator/index.d.ts +1 -0
  208. package/dist/generator/index.mjs +1 -0
  209. package/dist/generator/reduce.cjs +2 -6
  210. package/dist/generator/reduce.d.ts +1 -0
  211. package/dist/generator/reduce.mjs +2 -6
  212. package/dist/index.cjs +3 -2
  213. package/dist/index.d.ts +2 -0
  214. package/dist/index.mjs +3 -1
  215. package/dist/number/index.cjs +2 -0
  216. package/dist/number/index.d.ts +1 -0
  217. package/dist/number/index.mjs +1 -0
  218. package/dist/number/max.cjs +2 -7
  219. package/dist/number/max.d.ts +2 -2
  220. package/dist/number/max.mjs +2 -7
  221. package/dist/number/min.cjs +2 -7
  222. package/dist/number/min.d.ts +2 -2
  223. package/dist/number/min.mjs +2 -7
  224. package/dist/number/sort.cjs +14 -0
  225. package/dist/number/sort.d.ts +3 -0
  226. package/dist/number/sort.mjs +12 -0
  227. package/dist/pattern/match/index.d.ts +3 -3
  228. package/dist/pattern/when.d.ts +5 -5
  229. package/dist/string/index.cjs +2 -0
  230. package/dist/string/index.d.ts +1 -0
  231. package/dist/string/index.mjs +1 -0
  232. package/dist/{array/sort/string.cjs → string/sort.cjs} +6 -6
  233. package/dist/string/sort.d.ts +3 -0
  234. package/dist/{array/sort/string.mjs → string/sort.mjs} +6 -6
  235. package/package.json +7 -2
  236. package/dist/array/sort/number.cjs +0 -14
  237. package/dist/array/sort/number.d.ts +0 -4
  238. package/dist/array/sort/number.mjs +0 -12
  239. package/dist/array/sort/string.d.ts +0 -4
  240. package/dist/common/not.cjs +0 -12
  241. package/dist/common/not.d.ts +0 -2
  242. package/dist/common/not.mjs +0 -10
  243. /package/dist/array/{sort/default.cjs → sort.cjs} +0 -0
  244. /package/dist/array/{sort/default.d.ts → sort.d.ts} +0 -0
  245. /package/dist/array/{sort/default.mjs → sort.mjs} +0 -0
@@ -2,11 +2,11 @@ import { dataParserInit, SymbolDataParserError, dataParserKind } from '../../bas
2
2
  import { SymbolDataParserErrorIssue, setErrorPath, popErrorPath } from '../../error.mjs';
3
3
  import { createDataParserKind } from '../../kind.mjs';
4
4
  import { memo } from '../../../common/memo.mjs';
5
- import { forward } from '../../../common/forward.mjs';
6
5
  import { pipe } from '../../../common/pipe.mjs';
7
6
  import { map } from '../../../array/map.mjs';
8
7
  import { filter } from '../../../array/filter.mjs';
9
8
  import { entries } from '../../../object/entries.mjs';
9
+ import { forward } from '../../../common/forward.mjs';
10
10
  import { createOverride } from '../../../common/override.mjs';
11
11
 
12
12
  const objectKind = createDataParserKind("object");
@@ -41,7 +41,7 @@ function object(shape, definition) {
41
41
  output[entry.key] = result;
42
42
  }
43
43
  }
44
- popErrorPath(error);
44
+ void (self.definition.optimizedShape.value.length && popErrorPath(error));
45
45
  return output;
46
46
  },
47
47
  async: async (data, error, self) => {
@@ -63,7 +63,7 @@ function object(shape, definition) {
63
63
  output[entry.key] = result;
64
64
  }
65
65
  }
66
- popErrorPath(error);
66
+ void (self.definition.optimizedShape.value.length && popErrorPath(error));
67
67
  return output;
68
68
  },
69
69
  });
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index.cjs');
4
+ var optional = require('../optional.cjs');
5
+ var identifier = require('../../identifier.cjs');
6
+ var forward = require('../../../common/forward.cjs');
7
+ var pipe = require('../../../common/pipe.cjs');
8
+ var map = require('../../../array/map.cjs');
9
+ var when = require('../../../either/right/when.cjs');
10
+ var when$1 = require('../../../either/left/when.cjs');
11
+ var entry = require('../../../object/entry.cjs');
12
+ var entries = require('../../../object/entries.cjs');
13
+ var fromEntries = require('../../../object/fromEntries.cjs');
14
+
15
+ function partial(dataParser, definition) {
16
+ const newShape = pipe.pipe(dataParser.definition.shape, entries.entries, map.map(([key, dataParser]) => pipe.pipe(identifier.identifier(dataParser, optional.optionalKind), when.whenIsRight(forward.forward), when$1.whenIsLeft(optional.optional), (dataParser) => entry.entry(key, dataParser))), fromEntries.fromEntries);
17
+ return index.object(newShape, definition);
18
+ }
19
+
20
+ exports.partial = partial;
@@ -0,0 +1,14 @@
1
+ import { type MergeDefinition } from "../../../dataParser/types";
2
+ import { type DataParserObjectShape, type DataParserDefinitionObject, type DataParserObject } from ".";
3
+ import { type NeverCoalescing, type SimplifyTopLevel } from "../../../common";
4
+ import { type DataParserOptionalCheckers, type DataParserOptional } from "../optional";
5
+ export type PartialDataParserObject<GenericShape extends DataParserObjectShape> = SimplifyTopLevel<{
6
+ [Prop in keyof GenericShape]: GenericShape[Prop] extends DataParserOptional<any> ? GenericShape[Prop] : DataParserOptional<{
7
+ inner: GenericShape[Prop];
8
+ checkers: DataParserOptionalCheckers[];
9
+ coalescingValue: unknown;
10
+ }>;
11
+ }>;
12
+ export declare function partial<GenericDataParserObject extends DataParserObject, const GenericDefinition extends Partial<Omit<DataParserDefinitionObject, "shape" | "optimizedShape">> = never>(dataParser: GenericDataParserObject, definition?: GenericDefinition): DataParserObject<MergeDefinition<DataParserDefinitionObject, NeverCoalescing<GenericDefinition, {}> & {
13
+ readonly shape: PartialDataParserObject<GenericDataParserObject["definition"]["shape"]>;
14
+ }>>;
@@ -0,0 +1,18 @@
1
+ import { object } from './index.mjs';
2
+ import { optionalKind, optional } from '../optional.mjs';
3
+ import { identifier } from '../../identifier.mjs';
4
+ import { forward } from '../../../common/forward.mjs';
5
+ import { pipe } from '../../../common/pipe.mjs';
6
+ import { map } from '../../../array/map.mjs';
7
+ import { whenIsRight } from '../../../either/right/when.mjs';
8
+ import { whenIsLeft } from '../../../either/left/when.mjs';
9
+ import { entry } from '../../../object/entry.mjs';
10
+ import { entries } from '../../../object/entries.mjs';
11
+ import { fromEntries } from '../../../object/fromEntries.mjs';
12
+
13
+ function partial(dataParser, definition) {
14
+ const newShape = pipe(dataParser.definition.shape, entries, map(([key, dataParser]) => pipe(identifier(dataParser, optionalKind), whenIsRight(forward), whenIsLeft(optional), (dataParser) => entry(key, dataParser))), fromEntries);
15
+ return object(newShape, definition);
16
+ }
17
+
18
+ export { partial };
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index.cjs');
4
+ var optional = require('../optional.cjs');
5
+ var identifier = require('../../identifier.cjs');
6
+ var pipe = require('../../../common/pipe.cjs');
7
+ var map = require('../../../array/map.cjs');
8
+ var when = require('../../../either/right/when.cjs');
9
+ var when$1 = require('../../../either/left/when.cjs');
10
+ var forward = require('../../../common/forward.cjs');
11
+ var entry = require('../../../object/entry.cjs');
12
+ var entries = require('../../../object/entries.cjs');
13
+ var fromEntries = require('../../../object/fromEntries.cjs');
14
+
15
+ function required(dataParser, definition) {
16
+ const newShape = pipe.pipe(dataParser.definition.shape, entries.entries, map.map(([key, dataParser]) => pipe.pipe(identifier.identifier(dataParser, optional.optionalKind), when.whenIsRight((dataParser) => dataParser.definition.inner), when$1.whenIsLeft(forward.forward), (dataParser) => entry.entry(key, dataParser))), fromEntries.fromEntries);
17
+ return index.object(newShape, definition);
18
+ }
19
+
20
+ exports.required = required;
@@ -0,0 +1,10 @@
1
+ import { type MergeDefinition } from "../../../dataParser/types";
2
+ import { type DataParserObjectShape, type DataParserDefinitionObject, type DataParserObject } from ".";
3
+ import { type NeverCoalescing, type SimplifyTopLevel } from "../../../common";
4
+ import { type DataParserOptional } from "../optional";
5
+ export type RequireDataParserObject<GenericShape extends DataParserObjectShape> = SimplifyTopLevel<{
6
+ [Prop in keyof GenericShape]: GenericShape[Prop] extends DataParserOptional<any> ? GenericShape[Prop]["definition"]["inner"] : GenericShape[Prop];
7
+ }>;
8
+ export declare function required<GenericDataParserObject extends DataParserObject, const GenericDefinition extends Partial<Omit<DataParserDefinitionObject, "shape" | "optimizedShape">> = never>(dataParser: GenericDataParserObject, definition?: GenericDefinition): DataParserObject<MergeDefinition<DataParserDefinitionObject, NeverCoalescing<GenericDefinition, {}> & {
9
+ readonly shape: RequireDataParserObject<GenericDataParserObject["definition"]["shape"]>;
10
+ }>>;
@@ -0,0 +1,18 @@
1
+ import { object } from './index.mjs';
2
+ import { optionalKind } from '../optional.mjs';
3
+ import { identifier } from '../../identifier.mjs';
4
+ import { pipe } from '../../../common/pipe.mjs';
5
+ import { map } from '../../../array/map.mjs';
6
+ import { whenIsRight } from '../../../either/right/when.mjs';
7
+ import { whenIsLeft } from '../../../either/left/when.mjs';
8
+ import { forward } from '../../../common/forward.mjs';
9
+ import { entry } from '../../../object/entry.mjs';
10
+ import { entries } from '../../../object/entries.mjs';
11
+ import { fromEntries } from '../../../object/fromEntries.mjs';
12
+
13
+ function required(dataParser, definition) {
14
+ const newShape = pipe(dataParser.definition.shape, entries, map(([key, dataParser]) => pipe(identifier(dataParser, optionalKind), whenIsRight((dataParser) => dataParser.definition.inner), whenIsLeft(forward), (dataParser) => entry(key, dataParser))), fromEntries);
15
+ return object(newShape, definition);
16
+ }
17
+
18
+ export { required };
@@ -45,7 +45,7 @@ function record(key, value, definition) {
45
45
  output[resultKey] = resultValue;
46
46
  }
47
47
  }
48
- error.popErrorPath(error$1);
48
+ void (currentIndexPath !== error$1.currentPath.length && error.popErrorPath(error$1));
49
49
  if (output === base.SymbolDataParserError) {
50
50
  return output;
51
51
  }
@@ -83,7 +83,7 @@ function record(key, value, definition) {
83
83
  output[resultKey] = resultValue;
84
84
  }
85
85
  }
86
- error.popErrorPath(error$1);
86
+ void (currentIndexPath !== error$1.currentPath.length && error.popErrorPath(error$1));
87
87
  if (output === base.SymbolDataParserError) {
88
88
  return output;
89
89
  }
@@ -44,7 +44,7 @@ function record(key, value, definition) {
44
44
  output[resultKey] = resultValue;
45
45
  }
46
46
  }
47
- popErrorPath(error);
47
+ void (currentIndexPath !== error.currentPath.length && popErrorPath(error));
48
48
  if (output === SymbolDataParserError) {
49
49
  return output;
50
50
  }
@@ -82,7 +82,7 @@ function record(key, value, definition) {
82
82
  output[resultKey] = resultValue;
83
83
  }
84
84
  }
85
- popErrorPath(error);
85
+ void (currentIndexPath !== error.currentPath.length && popErrorPath(error));
86
86
  if (output === SymbolDataParserError) {
87
87
  return output;
88
88
  }
@@ -8,7 +8,7 @@ export declare const dataParserCheckerRefineKind: import("../../common").KindHan
8
8
  type _DataParserCheckerRefine<GenericDefinition extends DataParserCheckerDefinitionRefine> = (Kind<typeof dataParserCheckerRefineKind.definition> & DataParserChecker<GenericDefinition, string>);
9
9
  export interface DataParserCheckerRefine<GenericDefinition extends DataParserCheckerDefinitionRefine = DataParserCheckerDefinitionRefine> extends _DataParserCheckerRefine<GenericDefinition> {
10
10
  }
11
- export declare function checkerRefine<GenericInput extends unknown, const GenericDefinition extends Partial<Omit<DataParserCheckerDefinitionRefine, "theFunction">> = never>(theFunction: (input: GenericInput) => boolean, definition?: GenericDefinition): DataParserCheckerRefine<AssignObjects<NeverCoalescing<GenericDefinition, {}>, {
11
+ export declare function checkerRefine<GenericInput extends unknown, const GenericDefinition extends Partial<Omit<DataParserCheckerDefinitionRefine, "theFunction">> = never>(theFunction: (input: GenericInput) => boolean, definition?: GenericDefinition): DataParserCheckerRefine<AssignObjects<NeverCoalescing<GenericDefinition, DataParserCheckerDefinitionRefine>, {
12
12
  theFunction(input: GenericInput): boolean;
13
13
  }>>;
14
14
  export type CheckerRefineImplementation<GenericInput extends unknown> = DataParserCheckerRefine<AssignObjects<DataParserCheckerDefinitionRefine, {
@@ -43,7 +43,7 @@ function tuple(shape, definition) {
43
43
  }
44
44
  }
45
45
  }
46
- error.popErrorPath(error$1);
46
+ void (self.definition.shape.length && error.popErrorPath(error$1));
47
47
  return output;
48
48
  },
49
49
  async: async (data, error$1, self) => {
@@ -74,7 +74,7 @@ function tuple(shape, definition) {
74
74
  }
75
75
  }
76
76
  }
77
- error.popErrorPath(error$1);
77
+ void (self.definition.shape.length && error.popErrorPath(error$1));
78
78
  return output;
79
79
  },
80
80
  });
@@ -41,7 +41,7 @@ function tuple(shape, definition) {
41
41
  }
42
42
  }
43
43
  }
44
- popErrorPath(error);
44
+ void (self.definition.shape.length && popErrorPath(error));
45
45
  return output;
46
46
  },
47
47
  async: async (data, error, self) => {
@@ -72,7 +72,7 @@ function tuple(shape, definition) {
72
72
  }
73
73
  }
74
74
  }
75
- popErrorPath(error);
75
+ void (self.definition.shape.length && popErrorPath(error));
76
76
  return output;
77
77
  },
78
78
  });
@@ -14,6 +14,10 @@ var each = require('./each.cjs');
14
14
  var createOrThrow = require('./createOrThrow.cjs');
15
15
  var round = require('./round.cjs');
16
16
  var isSafeTimestamp = require('./isSafeTimestamp.cjs');
17
+ var min = require('./min.cjs');
18
+ var max = require('./max.cjs');
19
+ var sort = require('./sort.cjs');
20
+ var is = require('./is.cjs');
17
21
  var timezone = require('./types/timezone.cjs');
18
22
  var getDayOfMonth = require('./getters/getDayOfMonth.cjs');
19
23
  var getDayOfWeek = require('./getters/getDayOfWeek.cjs');
@@ -82,6 +86,10 @@ exports.CreateTheDateError = createOrThrow.CreateTheDateError;
82
86
  exports.createOrThrow = createOrThrow.createOrThrow;
83
87
  exports.round = round.round;
84
88
  exports.isSafeTimestamp = isSafeTimestamp.isSafeTimestamp;
89
+ exports.min = min.min;
90
+ exports.max = max.max;
91
+ exports.sort = sort.sort;
92
+ exports.is = is.is;
85
93
  exports.timezone = timezone.timezone;
86
94
  exports.getDayOfMonth = getDayOfMonth.getDayOfMonth;
87
95
  exports.getDayOfWeek = getDayOfWeek.getDayOfWeek;
@@ -16,3 +16,7 @@ export * from "./each";
16
16
  export * from "./createOrThrow";
17
17
  export * from "./round";
18
18
  export * from "./isSafeTimestamp";
19
+ export * from "./min";
20
+ export * from "./max";
21
+ export * from "./sort";
22
+ export * from "./is";
@@ -12,6 +12,10 @@ export { each } from './each.mjs';
12
12
  export { CreateTheDateError, createOrThrow } from './createOrThrow.mjs';
13
13
  export { round } from './round.mjs';
14
14
  export { isSafeTimestamp } from './isSafeTimestamp.mjs';
15
+ export { min } from './min.mjs';
16
+ export { max } from './max.mjs';
17
+ export { sort } from './sort.mjs';
18
+ export { is } from './is.mjs';
15
19
  export { timezone } from './types/timezone.mjs';
16
20
  export { getDayOfMonth } from './getters/getDayOfMonth.mjs';
17
21
  export { getDayOfWeek } from './getters/getDayOfWeek.mjs';
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var constants = require('./constants.cjs');
4
+
5
+ function is(input) {
6
+ return constants.theDateRegex.test(input);
7
+ }
8
+
9
+ exports.is = is;
@@ -0,0 +1,2 @@
1
+ import { type TheDate } from "./types";
2
+ export declare function is(input: string): input is TheDate;
@@ -0,0 +1,7 @@
1
+ import { theDateRegex } from './constants.mjs';
2
+
3
+ function is(input) {
4
+ return theDateRegex.test(input);
5
+ }
6
+
7
+ export { is };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var createOrThrow = require('./createOrThrow.cjs');
4
+ var toTimestamp = require('./toTimestamp.cjs');
5
+
6
+ function max(input) {
7
+ return createOrThrow.createOrThrow(Math.max(...input.map(toTimestamp.toTimestamp)));
8
+ }
9
+
10
+ exports.max = max;
@@ -0,0 +1,3 @@
1
+ import { type AnyTuple } from "../common";
2
+ import { type TheDate } from "./types";
3
+ export declare function max<GenericInput extends AnyTuple<TheDate>>(input: GenericInput): `date${number}-` | `date${number}+`;
@@ -0,0 +1,8 @@
1
+ import { createOrThrow } from './createOrThrow.mjs';
2
+ import { toTimestamp } from './toTimestamp.mjs';
3
+
4
+ function max(input) {
5
+ return createOrThrow(Math.max(...input.map(toTimestamp)));
6
+ }
7
+
8
+ export { max };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var createOrThrow = require('./createOrThrow.cjs');
4
+ var toTimestamp = require('./toTimestamp.cjs');
5
+
6
+ function min(input) {
7
+ return createOrThrow.createOrThrow(Math.min(...input.map(toTimestamp.toTimestamp)));
8
+ }
9
+
10
+ exports.min = min;
@@ -0,0 +1,3 @@
1
+ import { type AnyTuple } from "../common";
2
+ import { type TheDate } from "./types";
3
+ export declare function min<GenericInput extends AnyTuple<TheDate>>(input: GenericInput): `date${number}-` | `date${number}+`;
@@ -0,0 +1,8 @@
1
+ import { createOrThrow } from './createOrThrow.mjs';
2
+ import { toTimestamp } from './toTimestamp.mjs';
3
+
4
+ function min(input) {
5
+ return createOrThrow(Math.min(...input.map(toTimestamp)));
6
+ }
7
+
8
+ export { min };
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var createOrThrow = require('./createOrThrow.cjs');
4
+ var toTimestamp = require('./toTimestamp.cjs');
5
+
6
+ function sort(...args) {
7
+ if (args.length === 1) {
8
+ const [type] = args;
9
+ return (array) => sort(array, type);
10
+ }
11
+ const [array, type] = args;
12
+ return array
13
+ .map(toTimestamp.toTimestamp)
14
+ .sort(type === "DSC"
15
+ ? (first, second) => second - first
16
+ : (first, second) => first - second)
17
+ .map(createOrThrow.createOrThrow);
18
+ }
19
+
20
+ exports.sort = sort;
@@ -0,0 +1,4 @@
1
+ import { type SortType } from "../common";
2
+ import { type TheDate } from "./types";
3
+ export declare function sort<GenericArray extends readonly TheDate[]>(type: SortType): (array: GenericArray) => TheDate[];
4
+ export declare function sort<GenericArray extends readonly TheDate[]>(array: GenericArray, type: SortType): TheDate[];
@@ -0,0 +1,18 @@
1
+ import { createOrThrow } from './createOrThrow.mjs';
2
+ import { toTimestamp } from './toTimestamp.mjs';
3
+
4
+ function sort(...args) {
5
+ if (args.length === 1) {
6
+ const [type] = args;
7
+ return (array) => sort(array, type);
8
+ }
9
+ const [array, type] = args;
10
+ return array
11
+ .map(toTimestamp)
12
+ .sort(type === "DSC"
13
+ ? (first, second) => second - first
14
+ : (first, second) => first - second)
15
+ .map(createOrThrow);
16
+ }
17
+
18
+ export { sort };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ function chunk(...args) {
4
+ if (args.length === 1) {
5
+ const [size] = args;
6
+ return (input) => chunk(input, size);
7
+ }
8
+ const [input, size] = args;
9
+ return (function* () {
10
+ let buffer = [];
11
+ for (const element of input) {
12
+ buffer.push(element);
13
+ if (buffer.length === size) {
14
+ yield buffer;
15
+ buffer = [];
16
+ }
17
+ }
18
+ if (buffer.length > 0) {
19
+ yield buffer;
20
+ }
21
+ })();
22
+ }
23
+
24
+ exports.chunk = chunk;
@@ -0,0 +1,2 @@
1
+ export declare function chunk<const GenericElement extends unknown>(size: number): (input: Iterable<GenericElement>) => Generator<GenericElement[], unknown, unknown>;
2
+ export declare function chunk<const GenericElement extends unknown>(input: Iterable<GenericElement>, size: number): Generator<GenericElement[], unknown, unknown>;
@@ -0,0 +1,22 @@
1
+ function chunk(...args) {
2
+ if (args.length === 1) {
3
+ const [size] = args;
4
+ return (input) => chunk(input, size);
5
+ }
6
+ const [input, size] = args;
7
+ return (function* () {
8
+ let buffer = [];
9
+ for (const element of input) {
10
+ buffer.push(element);
11
+ if (buffer.length === size) {
12
+ yield buffer;
13
+ buffer = [];
14
+ }
15
+ }
16
+ if (buffer.length > 0) {
17
+ yield buffer;
18
+ }
19
+ })();
20
+ }
21
+
22
+ export { chunk };
@@ -9,6 +9,7 @@ var reduce = require('./reduce.cjs');
9
9
  var asyncReduce = require('./asyncReduce.cjs');
10
10
  var loop = require('./loop.cjs');
11
11
  var asyncLoop = require('./asyncLoop.cjs');
12
+ var chunk = require('./chunk.cjs');
12
13
 
13
14
 
14
15
 
@@ -22,3 +23,4 @@ exports.reduceFrom = reduce.reduceFrom;
22
23
  exports.asyncReduce = asyncReduce.asyncReduce;
23
24
  exports.loop = loop.loop;
24
25
  exports.asyncLoop = asyncLoop.asyncLoop;
26
+ exports.chunk = chunk.chunk;
@@ -7,3 +7,4 @@ export * from "./reduce";
7
7
  export * from "./asyncReduce";
8
8
  export * from "./loop";
9
9
  export * from "./asyncLoop";
10
+ export * from "./chunk";
@@ -7,3 +7,4 @@ export { reduce, reduceFrom } from './reduce.mjs';
7
7
  export { asyncReduce } from './asyncReduce.mjs';
8
8
  export { loop } from './loop.mjs';
9
9
  export { asyncLoop } from './asyncLoop.mjs';
10
+ export { chunk } from './chunk.mjs';
@@ -3,7 +3,7 @@
3
3
  var kind = require('../common/kind.cjs');
4
4
  var wrapValue = require('../common/wrapValue.cjs');
5
5
  var unwrap = require('../common/unwrap.cjs');
6
- var override = require('../object/override.cjs');
6
+ var reduce$1 = require('../array/reduce.cjs');
7
7
 
8
8
  const generatorReduceFromKind = kind.createKind("generator-reduce-from");
9
9
  function reduceFrom(value) {
@@ -22,11 +22,7 @@ function reduce(...args) {
22
22
  element,
23
23
  index,
24
24
  lastValue,
25
- nextWithObject: ((object1, object2) => ({
26
- "-next": override.override(object1, object2),
27
- })),
28
- exit: (output) => ({ "-exit": output }),
29
- next: (output) => ({ "-next": output }),
25
+ ...reduce$1.reduceTools,
30
26
  });
31
27
  if ("-exit" in result) {
32
28
  return result["-exit"];
@@ -15,6 +15,7 @@ export interface GeneratorReduceFunctionParams<GenericElement extends unknown =
15
15
  nextWithObject: GenericOutput extends object ? (object1: GenericOutput, object2: Partial<GenericOutput>) => GeneratorReduceNext<GenericOutput> : undefined;
16
16
  next(output: GenericOutput): GeneratorReduceNext<GenericOutput>;
17
17
  exit<GenericExitValue extends unknown>(output: GenericExitValue): GeneratorReduceExit<GenericExitValue>;
18
+ nextPush: GenericOutput extends readonly any[] ? (array: GenericOutput, ...values: GenericOutput) => GeneratorReduceExit<GenericOutput> : undefined;
18
19
  }
19
20
  declare const generatorReduceFromKind: import("../common").KindHandler<import("../common").KindDefinition<"generator-reduce-from", unknown>>;
20
21
  export interface GeneratorReduceFromResult<GenericValue extends unknown = unknown> extends Kind<typeof generatorReduceFromKind.definition>, WrappedValue<GenericValue> {
@@ -1,7 +1,7 @@
1
1
  import { createKind } from '../common/kind.mjs';
2
2
  import { wrapValue } from '../common/wrapValue.mjs';
3
3
  import { unwrap } from '../common/unwrap.mjs';
4
- import { override } from '../object/override.mjs';
4
+ import { reduceTools } from '../array/reduce.mjs';
5
5
 
6
6
  const generatorReduceFromKind = createKind("generator-reduce-from");
7
7
  function reduceFrom(value) {
@@ -20,11 +20,7 @@ function reduce(...args) {
20
20
  element,
21
21
  index,
22
22
  lastValue,
23
- nextWithObject: ((object1, object2) => ({
24
- "-next": override(object1, object2),
25
- })),
26
- exit: (output) => ({ "-exit": output }),
27
- next: (output) => ({ "-next": output }),
23
+ ...reduceTools,
28
24
  });
29
25
  if ("-exit" in result) {
30
26
  return result["-exit"];
package/dist/index.cjs CHANGED
@@ -11,6 +11,7 @@ var index$7 = require('./dataParser/index.cjs');
11
11
  var index$8 = require('./dataParser/parsers/coerce/index.cjs');
12
12
  var index$9 = require('./dataParser/extended/index.cjs');
13
13
  var index$a = require('./date/index.cjs');
14
+ var index$b = require('./clean/index.cjs');
14
15
  var addWrappedProperties = require('./common/addWrappedProperties.cjs');
15
16
  var asyncPipe = require('./common/asyncPipe.cjs');
16
17
  var clone = require('./common/clone.cjs');
@@ -40,7 +41,6 @@ var forward = require('./common/forward.cjs');
40
41
  var when = require('./common/when.cjs');
41
42
  var whenNot = require('./common/whenNot.cjs');
42
43
  var equal = require('./common/equal.cjs');
43
- var not = require('./common/not.cjs');
44
44
  var isType = require('./common/isType.cjs');
45
45
  var and = require('./common/and.cjs');
46
46
  var or = require('./common/or.cjs');
@@ -79,6 +79,8 @@ exports.DDataParserExtended = index$9;
79
79
  exports.DPE = index$9;
80
80
  exports.D = index$a;
81
81
  exports.DDate = index$a;
82
+ exports.C = index$b;
83
+ exports.DClean = index$b;
82
84
  exports.addWrappedProperties = addWrappedProperties.addWrappedProperties;
83
85
  exports.asyncPipe = asyncPipe.asyncPipe;
84
86
  exports.clone = clone.clone;
@@ -118,7 +120,6 @@ exports.forward = forward.forward;
118
120
  exports.when = when.when;
119
121
  exports.whenNot = whenNot.whenNot;
120
122
  exports.equal = equal.equal;
121
- exports.not = not.not;
122
123
  exports.isType = isType.isType;
123
124
  exports.and = and.and;
124
125
  exports.or = or.or;
package/dist/index.d.ts CHANGED
@@ -21,3 +21,5 @@ export * as DPE from "./dataParser/extended";
21
21
  export * as DDataParserExtended from "./dataParser/extended";
22
22
  export * as D from "./date";
23
23
  export * as DDate from "./date";
24
+ export * as C from "./clean";
25
+ export * as DClean from "./clean";
package/dist/index.mjs CHANGED
@@ -31,6 +31,9 @@ export { index$9 as DPE };
31
31
  import * as index$a from './date/index.mjs';
32
32
  export { index$a as D };
33
33
  export { index$a as DDate };
34
+ import * as index$b from './clean/index.mjs';
35
+ export { index$b as C };
36
+ export { index$b as DClean };
34
37
  export { addWrappedProperties } from './common/addWrappedProperties.mjs';
35
38
  export { asyncPipe } from './common/asyncPipe.mjs';
36
39
  export { clone } from './common/clone.mjs';
@@ -60,7 +63,6 @@ export { forward } from './common/forward.mjs';
60
63
  export { when } from './common/when.mjs';
61
64
  export { whenNot } from './common/whenNot.mjs';
62
65
  export { equal } from './common/equal.mjs';
63
- export { not } from './common/not.mjs';
64
66
  export { isType } from './common/isType.mjs';
65
67
  export { and } from './common/and.mjs';
66
68
  export { or } from './common/or.mjs';
@@ -30,6 +30,7 @@ var toFixed = require('./toFixed.cjs');
30
30
  var sqrt = require('./sqrt.cjs');
31
31
  var between = require('./between.cjs');
32
32
  var betweenThan = require('./betweenThan.cjs');
33
+ var sort = require('./sort.cjs');
33
34
 
34
35
 
35
36
 
@@ -63,3 +64,4 @@ exports.toFixed = toFixed.toFixed;
63
64
  exports.sqrt = sqrt.sqrt;
64
65
  exports.between = between.between;
65
66
  exports.betweenThan = betweenThan.betweenThan;
67
+ exports.sort = sort.sort;
@@ -29,3 +29,4 @@ export * from "./sqrt";
29
29
  export * from "./types";
30
30
  export * from "./between";
31
31
  export * from "./betweenThan";
32
+ export * from "./sort";
@@ -28,3 +28,4 @@ export { toFixed } from './toFixed.mjs';
28
28
  export { sqrt } from './sqrt.mjs';
29
29
  export { between } from './between.mjs';
30
30
  export { betweenThan } from './betweenThan.mjs';
31
+ export { sort } from './sort.mjs';
@@ -1,12 +1,7 @@
1
1
  'use strict';
2
2
 
3
- function max(...args) {
4
- if (args.length === 1) {
5
- const [comparison] = args;
6
- return (value) => max(value, comparison);
7
- }
8
- const [value, comparison] = args;
9
- return Math.max(value, comparison);
3
+ function max(input) {
4
+ return Math.max(...input);
10
5
  }
11
6
 
12
7
  exports.max = max;
@@ -1,2 +1,2 @@
1
- export declare function max<GenericValue extends number>(comparison: number): (value: GenericValue) => number;
2
- export declare function max<GenericValue extends number>(value: GenericValue, comparison: number): number;
1
+ import { type AnyTuple } from "../common";
2
+ export declare function max<GenericInput extends AnyTuple<number>>(input: GenericInput): number;