@duplojs/utils 1.2.18 → 1.3.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 (218) hide show
  1. package/dist/array/every.cjs +6 -3
  2. package/dist/array/every.d.ts +4 -3
  3. package/dist/array/every.mjs +6 -3
  4. package/dist/array/fill/all.d.ts +2 -2
  5. package/dist/array/filter.cjs +6 -3
  6. package/dist/array/filter.d.ts +6 -5
  7. package/dist/array/filter.mjs +6 -3
  8. package/dist/array/flatMap.cjs +6 -3
  9. package/dist/array/flatMap.d.ts +4 -3
  10. package/dist/array/flatMap.mjs +6 -3
  11. package/dist/array/index.cjs +11 -10
  12. package/dist/array/index.d.ts +2 -0
  13. package/dist/array/index.mjs +4 -4
  14. package/dist/array/insert.cjs +12 -0
  15. package/dist/array/insert.d.ts +2 -0
  16. package/dist/array/insert.mjs +10 -0
  17. package/dist/array/isLastIndex.cjs +12 -0
  18. package/dist/array/isLastIndex.d.ts +2 -0
  19. package/dist/array/isLastIndex.mjs +10 -0
  20. package/dist/array/map.cjs +6 -3
  21. package/dist/array/map.d.ts +4 -3
  22. package/dist/array/map.mjs +6 -3
  23. package/dist/array/push.cjs +3 -3
  24. package/dist/array/push.d.ts +2 -2
  25. package/dist/array/push.mjs +3 -3
  26. package/dist/array/reduce.cjs +22 -9
  27. package/dist/array/reduce.d.ts +7 -4
  28. package/dist/array/reduce.mjs +22 -10
  29. package/dist/array/reduceRight.cjs +7 -10
  30. package/dist/array/reduceRight.d.ts +2 -2
  31. package/dist/array/reduceRight.mjs +7 -10
  32. package/dist/array/some.cjs +6 -3
  33. package/dist/array/some.d.ts +4 -3
  34. package/dist/array/some.mjs +6 -3
  35. package/dist/array/types/ArrayCoalescing.d.ts +1 -1
  36. package/dist/clean/constraint/base.cjs +77 -0
  37. package/dist/clean/constraint/base.d.ts +36 -0
  38. package/dist/clean/constraint/base.mjs +72 -0
  39. package/dist/{array/sort → clean/constraint/defaultConstraint}/index.d.ts +0 -1
  40. package/dist/clean/constraint/defaultConstraint/number.cjs +15 -0
  41. package/dist/clean/constraint/defaultConstraint/number.d.ts +8 -0
  42. package/dist/clean/constraint/defaultConstraint/number.mjs +11 -0
  43. package/dist/clean/constraint/defaultConstraint/string.cjs +12 -0
  44. package/dist/clean/constraint/defaultConstraint/string.d.ts +6 -0
  45. package/dist/clean/constraint/defaultConstraint/string.mjs +9 -0
  46. package/dist/clean/constraint/index.d.ts +2 -0
  47. package/dist/clean/entity.cjs +125 -0
  48. package/dist/clean/entity.d.ts +74 -0
  49. package/dist/clean/entity.mjs +121 -0
  50. package/dist/clean/flag.cjs +26 -0
  51. package/dist/clean/flag.d.ts +16 -0
  52. package/dist/clean/flag.mjs +23 -0
  53. package/dist/clean/index.cjs +84 -0
  54. package/dist/clean/index.d.ts +8 -0
  55. package/dist/clean/index.mjs +29 -0
  56. package/dist/clean/kind.cjs +9 -0
  57. package/dist/clean/kind.d.ts +1 -0
  58. package/dist/clean/kind.mjs +7 -0
  59. package/dist/clean/newType.cjs +91 -0
  60. package/dist/clean/newType.d.ts +38 -0
  61. package/dist/clean/newType.mjs +86 -0
  62. package/dist/clean/primitive/base.cjs +72 -0
  63. package/dist/clean/primitive/base.d.ts +36 -0
  64. package/dist/clean/primitive/base.mjs +64 -0
  65. package/dist/clean/primitive/index.d.ts +2 -0
  66. package/dist/clean/primitive/operations/date/dateGreaterThan.cjs +15 -0
  67. package/dist/clean/primitive/operations/date/dateGreaterThan.d.ts +4 -0
  68. package/dist/clean/primitive/operations/date/dateGreaterThan.mjs +13 -0
  69. package/dist/clean/primitive/operations/date/dateLessThan.cjs +15 -0
  70. package/dist/clean/primitive/operations/date/dateLessThan.d.ts +4 -0
  71. package/dist/clean/primitive/operations/date/dateLessThan.mjs +13 -0
  72. package/dist/clean/primitive/operations/date/dateMax.cjs +15 -0
  73. package/dist/clean/primitive/operations/date/dateMax.d.ts +5 -0
  74. package/dist/clean/primitive/operations/date/dateMax.mjs +13 -0
  75. package/dist/clean/primitive/operations/date/dateMin.cjs +15 -0
  76. package/dist/clean/primitive/operations/date/dateMin.d.ts +5 -0
  77. package/dist/clean/primitive/operations/date/dateMin.mjs +13 -0
  78. package/dist/clean/primitive/operations/date/index.d.ts +8 -0
  79. package/dist/clean/primitive/operations/equal.cjs +14 -0
  80. package/dist/clean/primitive/operations/equal.d.ts +4 -0
  81. package/dist/clean/primitive/operations/equal.mjs +12 -0
  82. package/dist/clean/primitive/operations/index.d.ts +5 -0
  83. package/dist/clean/primitive/operations/number/add.cjs +15 -0
  84. package/dist/clean/primitive/operations/number/add.d.ts +3 -0
  85. package/dist/clean/primitive/operations/number/add.mjs +13 -0
  86. package/dist/clean/primitive/operations/number/divide.cjs +15 -0
  87. package/dist/clean/primitive/operations/number/divide.d.ts +3 -0
  88. package/dist/clean/primitive/operations/number/divide.mjs +13 -0
  89. package/dist/clean/primitive/operations/number/greaterThan.cjs +14 -0
  90. package/dist/clean/primitive/operations/number/greaterThan.d.ts +3 -0
  91. package/dist/clean/primitive/operations/number/greaterThan.mjs +12 -0
  92. package/dist/clean/primitive/operations/number/index.d.ts +8 -0
  93. package/dist/clean/primitive/operations/number/lessThan.cjs +14 -0
  94. package/dist/clean/primitive/operations/number/lessThan.d.ts +3 -0
  95. package/dist/clean/primitive/operations/number/lessThan.mjs +12 -0
  96. package/dist/clean/primitive/operations/number/max.cjs +10 -0
  97. package/dist/clean/primitive/operations/number/max.d.ts +3 -0
  98. package/dist/clean/primitive/operations/number/max.mjs +8 -0
  99. package/dist/clean/primitive/operations/number/min.cjs +10 -0
  100. package/dist/clean/primitive/operations/number/min.d.ts +3 -0
  101. package/dist/clean/primitive/operations/number/min.mjs +8 -0
  102. package/dist/clean/primitive/operations/number/multiply.cjs +15 -0
  103. package/dist/clean/primitive/operations/number/multiply.d.ts +3 -0
  104. package/dist/clean/primitive/operations/number/multiply.mjs +13 -0
  105. package/dist/clean/primitive/operations/number/subtract.cjs +15 -0
  106. package/dist/clean/primitive/operations/number/subtract.d.ts +3 -0
  107. package/dist/clean/primitive/operations/number/subtract.mjs +13 -0
  108. package/dist/clean/primitive/operations/sort.cjs +35 -0
  109. package/dist/clean/primitive/operations/sort.d.ts +9 -0
  110. package/dist/clean/primitive/operations/sort.mjs +33 -0
  111. package/dist/clean/primitive/operations/string/concat.cjs +16 -0
  112. package/dist/clean/primitive/operations/string/concat.d.ts +3 -0
  113. package/dist/clean/primitive/operations/string/concat.mjs +14 -0
  114. package/dist/clean/primitive/operations/string/index.d.ts +5 -0
  115. package/dist/clean/primitive/operations/string/length.cjs +10 -0
  116. package/dist/clean/primitive/operations/string/length.d.ts +2 -0
  117. package/dist/clean/primitive/operations/string/length.mjs +8 -0
  118. package/dist/clean/primitive/operations/string/lengthEqual.cjs +14 -0
  119. package/dist/clean/primitive/operations/string/lengthEqual.d.ts +3 -0
  120. package/dist/clean/primitive/operations/string/lengthEqual.mjs +12 -0
  121. package/dist/clean/primitive/operations/string/lengthGreaterThan.cjs +14 -0
  122. package/dist/clean/primitive/operations/string/lengthGreaterThan.d.ts +3 -0
  123. package/dist/clean/primitive/operations/string/lengthGreaterThan.mjs +12 -0
  124. package/dist/clean/primitive/operations/string/lengthLessThan.cjs +14 -0
  125. package/dist/clean/primitive/operations/string/lengthLessThan.d.ts +3 -0
  126. package/dist/clean/primitive/operations/string/lengthLessThan.mjs +12 -0
  127. package/dist/clean/repository.cjs +15 -0
  128. package/dist/clean/repository.d.ts +8 -0
  129. package/dist/clean/repository.mjs +12 -0
  130. package/dist/clean/useCase.cjs +25 -0
  131. package/dist/clean/useCase.d.ts +23 -0
  132. package/dist/clean/useCase.mjs +21 -0
  133. package/dist/common/index.d.ts +0 -1
  134. package/dist/common/kind.d.ts +1 -0
  135. package/dist/common/types/index.d.ts +1 -0
  136. package/dist/common/types/sortType.d.ts +1 -0
  137. package/dist/common/unwrap.d.ts +1 -2
  138. package/dist/dataParser/base.d.ts +5 -4
  139. package/dist/dataParser/baseExtended.d.ts +2 -1
  140. package/dist/dataParser/extended/index.d.ts +1 -0
  141. package/dist/dataParser/extended/number.cjs +3 -0
  142. package/dist/dataParser/extended/number.d.ts +3 -0
  143. package/dist/dataParser/extended/number.mjs +3 -0
  144. package/dist/dataParser/extended/object.cjs +8 -13
  145. package/dist/dataParser/extended/object.d.ts +2 -0
  146. package/dist/dataParser/extended/object.mjs +8 -13
  147. package/dist/dataParser/identifier.d.ts +40 -40
  148. package/dist/dataParser/index.cjs +4 -0
  149. package/dist/dataParser/index.mjs +2 -0
  150. package/dist/dataParser/parsers/array/index.cjs +2 -2
  151. package/dist/dataParser/parsers/array/index.mjs +2 -2
  152. package/dist/dataParser/parsers/literal.d.ts +1 -1
  153. package/dist/dataParser/parsers/object/index.cjs +3 -3
  154. package/dist/dataParser/parsers/object/index.d.ts +2 -0
  155. package/dist/dataParser/parsers/object/index.mjs +3 -3
  156. package/dist/dataParser/parsers/object/partial.cjs +20 -0
  157. package/dist/dataParser/parsers/object/partial.d.ts +14 -0
  158. package/dist/dataParser/parsers/object/partial.mjs +18 -0
  159. package/dist/dataParser/parsers/object/required.cjs +20 -0
  160. package/dist/dataParser/parsers/object/required.d.ts +10 -0
  161. package/dist/dataParser/parsers/object/required.mjs +18 -0
  162. package/dist/dataParser/parsers/record/index.cjs +2 -2
  163. package/dist/dataParser/parsers/record/index.mjs +2 -2
  164. package/dist/dataParser/parsers/recover.d.ts +1 -1
  165. package/dist/dataParser/parsers/refine.d.ts +1 -1
  166. package/dist/dataParser/parsers/tuple.cjs +2 -2
  167. package/dist/dataParser/parsers/tuple.mjs +2 -2
  168. package/dist/date/index.cjs +8 -0
  169. package/dist/date/index.d.ts +4 -0
  170. package/dist/date/index.mjs +4 -0
  171. package/dist/date/is.cjs +9 -0
  172. package/dist/date/is.d.ts +2 -0
  173. package/dist/date/is.mjs +7 -0
  174. package/dist/date/max.cjs +10 -0
  175. package/dist/date/max.d.ts +3 -0
  176. package/dist/date/max.mjs +8 -0
  177. package/dist/date/min.cjs +10 -0
  178. package/dist/date/min.d.ts +3 -0
  179. package/dist/date/min.mjs +8 -0
  180. package/dist/date/sort.cjs +20 -0
  181. package/dist/date/sort.d.ts +4 -0
  182. package/dist/date/sort.mjs +18 -0
  183. package/dist/generator/reduce.cjs +2 -6
  184. package/dist/generator/reduce.d.ts +1 -0
  185. package/dist/generator/reduce.mjs +2 -6
  186. package/dist/index.cjs +3 -2
  187. package/dist/index.d.ts +2 -0
  188. package/dist/index.mjs +3 -1
  189. package/dist/number/index.cjs +2 -0
  190. package/dist/number/index.d.ts +1 -0
  191. package/dist/number/index.mjs +1 -0
  192. package/dist/number/max.cjs +2 -7
  193. package/dist/number/max.d.ts +2 -2
  194. package/dist/number/max.mjs +2 -7
  195. package/dist/number/min.cjs +2 -7
  196. package/dist/number/min.d.ts +2 -2
  197. package/dist/number/min.mjs +2 -7
  198. package/dist/number/sort.cjs +14 -0
  199. package/dist/number/sort.d.ts +3 -0
  200. package/dist/number/sort.mjs +12 -0
  201. package/dist/pattern/when.d.ts +5 -5
  202. package/dist/string/index.cjs +2 -0
  203. package/dist/string/index.d.ts +1 -0
  204. package/dist/string/index.mjs +1 -0
  205. package/dist/{array/sort/string.cjs → string/sort.cjs} +6 -6
  206. package/dist/string/sort.d.ts +3 -0
  207. package/dist/{array/sort/string.mjs → string/sort.mjs} +6 -6
  208. package/package.json +7 -2
  209. package/dist/array/sort/number.cjs +0 -14
  210. package/dist/array/sort/number.d.ts +0 -4
  211. package/dist/array/sort/number.mjs +0 -12
  212. package/dist/array/sort/string.d.ts +0 -4
  213. package/dist/common/not.cjs +0 -12
  214. package/dist/common/not.d.ts +0 -2
  215. package/dist/common/not.mjs +0 -10
  216. /package/dist/array/{sort/default.cjs → sort.cjs} +0 -0
  217. /package/dist/array/{sort/default.d.ts → sort.d.ts} +0 -0
  218. /package/dist/array/{sort/default.mjs → sort.mjs} +0 -0
@@ -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
  }
@@ -21,7 +21,7 @@ export interface DataParserRecover<GenericDefinition extends DataParserDefinitio
21
21
  ...DataParserRecoverCheckers<Output<this>>[]
22
22
  ], GenericChecker>): DataParserRecover<AddCheckersToDefinition<GenericDefinition, GenericChecker>>;
23
23
  }
24
- export declare function recover<GenericDataParser extends DataParser, GenericRecoveredValue extends unknown, const GenericDefinition extends Partial<Omit<DataParserDefinitionRecover, "inner" | "recoveredValue">> = never>(inner: GenericDataParser, recoveredValue: GenericRecoveredValue, definition?: GenericDefinition): DataParserRecover<MergeDefinition<DataParserDefinitionRecover, NeverCoalescing<GenericDefinition, {}> & {
24
+ export declare function recover<GenericDataParser extends DataParser, GenericRecoveredValue extends Output<GenericDataParser>, const GenericDefinition extends Partial<Omit<DataParserDefinitionRecover, "inner" | "recoveredValue">> = never>(inner: GenericDataParser, recoveredValue: GenericRecoveredValue, definition?: GenericDefinition): DataParserRecover<MergeDefinition<DataParserDefinitionRecover, NeverCoalescing<GenericDefinition, {}> & {
25
25
  inner: GenericDataParser;
26
26
  recoveredValue: GenericRecoveredValue;
27
27
  }>>;
@@ -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 };
@@ -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;
@@ -1,10 +1,5 @@
1
- function max(...args) {
2
- if (args.length === 1) {
3
- const [comparison] = args;
4
- return (value) => max(value, comparison);
5
- }
6
- const [value, comparison] = args;
7
- return Math.max(value, comparison);
1
+ function max(input) {
2
+ return Math.max(...input);
8
3
  }
9
4
 
10
5
  export { max };
@@ -1,12 +1,7 @@
1
1
  'use strict';
2
2
 
3
- function min(...args) {
4
- if (args.length === 1) {
5
- const [comparison] = args;
6
- return (value) => min(value, comparison);
7
- }
8
- const [value, comparison] = args;
9
- return Math.min(value, comparison);
3
+ function min(input) {
4
+ return Math.min(...input);
10
5
  }
11
6
 
12
7
  exports.min = min;
@@ -1,2 +1,2 @@
1
- export declare function min<GenericValue extends number>(comparison: number): (value: GenericValue) => number;
2
- export declare function min<GenericValue extends number>(value: GenericValue, comparison: number): number;
1
+ import { type AnyTuple } from "../common";
2
+ export declare function min<GenericInput extends AnyTuple<number>>(input: GenericInput): number;
@@ -1,10 +1,5 @@
1
- function min(...args) {
2
- if (args.length === 1) {
3
- const [comparison] = args;
4
- return (value) => min(value, comparison);
5
- }
6
- const [value, comparison] = args;
7
- return Math.min(value, comparison);
1
+ function min(input) {
2
+ return Math.min(...input);
8
3
  }
9
4
 
10
5
  export { min };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ function sort(...args) {
4
+ if (args.length === 1) {
5
+ const [type] = args;
6
+ return (array) => sort(array, type);
7
+ }
8
+ const [array, type] = args;
9
+ return [...array].sort(type === "DSC"
10
+ ? (first, second) => second - first
11
+ : (first, second) => first - second);
12
+ }
13
+
14
+ exports.sort = sort;
@@ -0,0 +1,3 @@
1
+ import { type SortType } from "../common";
2
+ export declare function sort<GenericArray extends readonly number[]>(type: SortType): (array: GenericArray) => number[];
3
+ export declare function sort<GenericArray extends readonly number[]>(array: GenericArray, type: SortType): number[];
@@ -0,0 +1,12 @@
1
+ function sort(...args) {
2
+ if (args.length === 1) {
3
+ const [type] = args;
4
+ return (array) => sort(array, type);
5
+ }
6
+ const [array, type] = args;
7
+ return [...array].sort(type === "DSC"
8
+ ? (first, second) => second - first
9
+ : (first, second) => first - second);
10
+ }
11
+
12
+ export { sort };
@@ -1,6 +1,6 @@
1
- import { type AnyValue, type BreakGenericLink, type IsEqual } from "../common";
1
+ import { type AnyValue, type BreakGenericLink, type IsEqual, type EscapeVoid } from "../common";
2
2
  import { type PatternResult } from "./result";
3
- export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericPredicatedInput extends GenericInputValue, GenericOutput extends AnyValue>(predicate: (input: GenericInputValue) => input is GenericPredicatedInput, theFunction: (predicatedInput: GenericPredicatedInput) => GenericOutput): (input: (GenericInput | GenericInputPatternResult | GenericInputValue)) => (GenericInputPatternResult | Exclude<BreakGenericLink<GenericInputValue>, GenericPredicatedInput> | PatternResult<GenericOutput>);
4
- export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericOutput extends AnyValue>(predicate: (input: GenericInputValue) => boolean, theFunction: (predicatedInput: GenericInputValue) => GenericOutput): (input: (GenericInput | GenericInputPatternResult | GenericInputValue)) => (GenericInputPatternResult | GenericInputValue | PatternResult<GenericOutput>);
5
- export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericPredicatedInput extends GenericInputValue, GenericOutput extends AnyValue>(input: (GenericInput | GenericInputPatternResult | GenericInputValue), predicate: (input: GenericInputValue) => input is GenericPredicatedInput, theFunction: (predicatedInput: GenericPredicatedInput) => GenericOutput): (GenericInputPatternResult | Exclude<GenericInputValue, GenericPredicatedInput> | PatternResult<GenericOutput>);
6
- export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericOutput extends AnyValue>(input: (GenericInput | GenericInputPatternResult | GenericInputValue), predicate: (input: GenericInputValue) => boolean, theFunction: (predicatedInput: GenericInputValue) => GenericOutput): (GenericInputPatternResult | GenericInputValue | PatternResult<GenericOutput>);
3
+ export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericPredicatedInput extends GenericInputValue, GenericOutput extends AnyValue | EscapeVoid>(predicate: (input: GenericInputValue) => input is GenericPredicatedInput, theFunction: (predicatedInput: GenericPredicatedInput) => GenericOutput): (input: (GenericInput | GenericInputPatternResult | GenericInputValue)) => (GenericInputPatternResult | Exclude<BreakGenericLink<GenericInput>, GenericPredicatedInput | PatternResult> | PatternResult<GenericOutput>);
4
+ export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericOutput extends AnyValue | EscapeVoid>(predicate: (input: GenericInputValue) => boolean, theFunction: (predicatedInput: GenericInputValue) => GenericOutput): (input: (GenericInput | GenericInputPatternResult | GenericInputValue)) => (GenericInputPatternResult | GenericInputValue | PatternResult<GenericOutput>);
5
+ export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericPredicatedInput extends GenericInputValue, GenericOutput extends AnyValue | EscapeVoid>(input: (GenericInput | GenericInputPatternResult | GenericInputValue), predicate: (input: GenericInputValue) => input is GenericPredicatedInput, theFunction: (predicatedInput: GenericPredicatedInput) => GenericOutput): (GenericInputPatternResult | Exclude<BreakGenericLink<GenericInput>, GenericPredicatedInput | PatternResult> | PatternResult<GenericOutput>);
6
+ export declare function when<GenericInput extends unknown, GenericInputValue extends Exclude<IsEqual<GenericInput, unknown> extends true ? AnyValue : GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, GenericOutput extends AnyValue | EscapeVoid>(input: (GenericInput | GenericInputPatternResult | GenericInputValue), predicate: (input: GenericInputValue) => boolean, theFunction: (predicatedInput: GenericInputValue) => GenericOutput): (GenericInputPatternResult | GenericInputValue | PatternResult<GenericOutput>);
@@ -27,6 +27,7 @@ var normalize = require('./normalize.cjs');
27
27
  var test = require('./test.cjs');
28
28
  var isIn = require('./isIn.cjs');
29
29
  var length = require('./length.cjs');
30
+ var sort = require('./sort.cjs');
30
31
  var _default = require('./at/default.cjs');
31
32
  var first = require('./at/first.cjs');
32
33
  var last = require('./at/last.cjs');
@@ -63,6 +64,7 @@ exports.normalize = normalize.normalize;
63
64
  exports.test = test.test;
64
65
  exports.isIn = isIn.isIn;
65
66
  exports.length = length.length;
67
+ exports.sort = sort.sort;
66
68
  exports.at = _default.at;
67
69
  exports.first = first.first;
68
70
  exports.last = last.last;
@@ -28,3 +28,4 @@ export * from "./normalize";
28
28
  export * from "./test";
29
29
  export * from "./isIn";
30
30
  export * from "./length";
31
+ export * from "./sort";
@@ -25,6 +25,7 @@ export { normalize } from './normalize.mjs';
25
25
  export { test } from './test.mjs';
26
26
  export { isIn } from './isIn.mjs';
27
27
  export { length } from './length.mjs';
28
+ export { sort } from './sort.mjs';
28
29
  export { at } from './at/default.mjs';
29
30
  export { first } from './at/first.mjs';
30
31
  export { last } from './at/last.mjs';