@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.
- package/dist/array/every.cjs +6 -3
- package/dist/array/every.d.ts +4 -3
- package/dist/array/every.mjs +6 -3
- package/dist/array/fill/all.d.ts +2 -2
- package/dist/array/filter.cjs +6 -3
- package/dist/array/filter.d.ts +6 -5
- package/dist/array/filter.mjs +6 -3
- package/dist/array/flatMap.cjs +6 -3
- package/dist/array/flatMap.d.ts +4 -3
- package/dist/array/flatMap.mjs +6 -3
- package/dist/array/index.cjs +11 -10
- package/dist/array/index.d.ts +2 -0
- package/dist/array/index.mjs +4 -4
- package/dist/array/insert.cjs +12 -0
- package/dist/array/insert.d.ts +2 -0
- package/dist/array/insert.mjs +10 -0
- package/dist/array/isLastIndex.cjs +12 -0
- package/dist/array/isLastIndex.d.ts +2 -0
- package/dist/array/isLastIndex.mjs +10 -0
- package/dist/array/map.cjs +6 -3
- package/dist/array/map.d.ts +4 -3
- package/dist/array/map.mjs +6 -3
- package/dist/array/push.cjs +3 -3
- package/dist/array/push.d.ts +2 -2
- package/dist/array/push.mjs +3 -3
- package/dist/array/reduce.cjs +22 -9
- package/dist/array/reduce.d.ts +7 -4
- package/dist/array/reduce.mjs +22 -10
- package/dist/array/reduceRight.cjs +7 -10
- package/dist/array/reduceRight.d.ts +2 -2
- package/dist/array/reduceRight.mjs +7 -10
- package/dist/array/some.cjs +6 -3
- package/dist/array/some.d.ts +4 -3
- package/dist/array/some.mjs +6 -3
- package/dist/array/types/ArrayCoalescing.d.ts +1 -1
- package/dist/clean/constraint/base.cjs +77 -0
- package/dist/clean/constraint/base.d.ts +36 -0
- package/dist/clean/constraint/base.mjs +72 -0
- package/dist/{array/sort → clean/constraint/defaultConstraint}/index.d.ts +0 -1
- package/dist/clean/constraint/defaultConstraint/number.cjs +15 -0
- package/dist/clean/constraint/defaultConstraint/number.d.ts +8 -0
- package/dist/clean/constraint/defaultConstraint/number.mjs +11 -0
- package/dist/clean/constraint/defaultConstraint/string.cjs +12 -0
- package/dist/clean/constraint/defaultConstraint/string.d.ts +6 -0
- package/dist/clean/constraint/defaultConstraint/string.mjs +9 -0
- package/dist/clean/constraint/index.d.ts +2 -0
- package/dist/clean/entity.cjs +125 -0
- package/dist/clean/entity.d.ts +74 -0
- package/dist/clean/entity.mjs +121 -0
- package/dist/clean/flag.cjs +26 -0
- package/dist/clean/flag.d.ts +16 -0
- package/dist/clean/flag.mjs +23 -0
- package/dist/clean/index.cjs +84 -0
- package/dist/clean/index.d.ts +8 -0
- package/dist/clean/index.mjs +29 -0
- package/dist/clean/kind.cjs +9 -0
- package/dist/clean/kind.d.ts +1 -0
- package/dist/clean/kind.mjs +7 -0
- package/dist/clean/newType.cjs +91 -0
- package/dist/clean/newType.d.ts +38 -0
- package/dist/clean/newType.mjs +86 -0
- package/dist/clean/primitive/base.cjs +72 -0
- package/dist/clean/primitive/base.d.ts +36 -0
- package/dist/clean/primitive/base.mjs +64 -0
- package/dist/clean/primitive/index.d.ts +2 -0
- package/dist/clean/primitive/operations/date/dateGreaterThan.cjs +15 -0
- package/dist/clean/primitive/operations/date/dateGreaterThan.d.ts +4 -0
- package/dist/clean/primitive/operations/date/dateGreaterThan.mjs +13 -0
- package/dist/clean/primitive/operations/date/dateLessThan.cjs +15 -0
- package/dist/clean/primitive/operations/date/dateLessThan.d.ts +4 -0
- package/dist/clean/primitive/operations/date/dateLessThan.mjs +13 -0
- package/dist/clean/primitive/operations/date/dateMax.cjs +15 -0
- package/dist/clean/primitive/operations/date/dateMax.d.ts +5 -0
- package/dist/clean/primitive/operations/date/dateMax.mjs +13 -0
- package/dist/clean/primitive/operations/date/dateMin.cjs +15 -0
- package/dist/clean/primitive/operations/date/dateMin.d.ts +5 -0
- package/dist/clean/primitive/operations/date/dateMin.mjs +13 -0
- package/dist/clean/primitive/operations/date/index.d.ts +8 -0
- package/dist/clean/primitive/operations/equal.cjs +14 -0
- package/dist/clean/primitive/operations/equal.d.ts +4 -0
- package/dist/clean/primitive/operations/equal.mjs +12 -0
- package/dist/clean/primitive/operations/index.d.ts +5 -0
- package/dist/clean/primitive/operations/number/add.cjs +15 -0
- package/dist/clean/primitive/operations/number/add.d.ts +3 -0
- package/dist/clean/primitive/operations/number/add.mjs +13 -0
- package/dist/clean/primitive/operations/number/divide.cjs +15 -0
- package/dist/clean/primitive/operations/number/divide.d.ts +3 -0
- package/dist/clean/primitive/operations/number/divide.mjs +13 -0
- package/dist/clean/primitive/operations/number/greaterThan.cjs +14 -0
- package/dist/clean/primitive/operations/number/greaterThan.d.ts +3 -0
- package/dist/clean/primitive/operations/number/greaterThan.mjs +12 -0
- package/dist/clean/primitive/operations/number/index.d.ts +8 -0
- package/dist/clean/primitive/operations/number/lessThan.cjs +14 -0
- package/dist/clean/primitive/operations/number/lessThan.d.ts +3 -0
- package/dist/clean/primitive/operations/number/lessThan.mjs +12 -0
- package/dist/clean/primitive/operations/number/max.cjs +10 -0
- package/dist/clean/primitive/operations/number/max.d.ts +3 -0
- package/dist/clean/primitive/operations/number/max.mjs +8 -0
- package/dist/clean/primitive/operations/number/min.cjs +10 -0
- package/dist/clean/primitive/operations/number/min.d.ts +3 -0
- package/dist/clean/primitive/operations/number/min.mjs +8 -0
- package/dist/clean/primitive/operations/number/multiply.cjs +15 -0
- package/dist/clean/primitive/operations/number/multiply.d.ts +3 -0
- package/dist/clean/primitive/operations/number/multiply.mjs +13 -0
- package/dist/clean/primitive/operations/number/subtract.cjs +15 -0
- package/dist/clean/primitive/operations/number/subtract.d.ts +3 -0
- package/dist/clean/primitive/operations/number/subtract.mjs +13 -0
- package/dist/clean/primitive/operations/sort.cjs +35 -0
- package/dist/clean/primitive/operations/sort.d.ts +9 -0
- package/dist/clean/primitive/operations/sort.mjs +33 -0
- package/dist/clean/primitive/operations/string/concat.cjs +16 -0
- package/dist/clean/primitive/operations/string/concat.d.ts +3 -0
- package/dist/clean/primitive/operations/string/concat.mjs +14 -0
- package/dist/clean/primitive/operations/string/index.d.ts +5 -0
- package/dist/clean/primitive/operations/string/length.cjs +10 -0
- package/dist/clean/primitive/operations/string/length.d.ts +2 -0
- package/dist/clean/primitive/operations/string/length.mjs +8 -0
- package/dist/clean/primitive/operations/string/lengthEqual.cjs +14 -0
- package/dist/clean/primitive/operations/string/lengthEqual.d.ts +3 -0
- package/dist/clean/primitive/operations/string/lengthEqual.mjs +12 -0
- package/dist/clean/primitive/operations/string/lengthGreaterThan.cjs +14 -0
- package/dist/clean/primitive/operations/string/lengthGreaterThan.d.ts +3 -0
- package/dist/clean/primitive/operations/string/lengthGreaterThan.mjs +12 -0
- package/dist/clean/primitive/operations/string/lengthLessThan.cjs +14 -0
- package/dist/clean/primitive/operations/string/lengthLessThan.d.ts +3 -0
- package/dist/clean/primitive/operations/string/lengthLessThan.mjs +12 -0
- package/dist/clean/repository.cjs +15 -0
- package/dist/clean/repository.d.ts +8 -0
- package/dist/clean/repository.mjs +12 -0
- package/dist/clean/useCase.cjs +25 -0
- package/dist/clean/useCase.d.ts +23 -0
- package/dist/clean/useCase.mjs +21 -0
- package/dist/common/index.d.ts +0 -1
- package/dist/common/kind.d.ts +1 -0
- package/dist/common/types/index.d.ts +1 -0
- package/dist/common/types/sortType.d.ts +1 -0
- package/dist/common/unwrap.d.ts +1 -2
- package/dist/dataParser/base.d.ts +5 -4
- package/dist/dataParser/baseExtended.d.ts +2 -1
- package/dist/dataParser/extended/index.d.ts +1 -0
- package/dist/dataParser/extended/number.cjs +3 -0
- package/dist/dataParser/extended/number.d.ts +3 -0
- package/dist/dataParser/extended/number.mjs +3 -0
- package/dist/dataParser/extended/object.cjs +8 -13
- package/dist/dataParser/extended/object.d.ts +2 -0
- package/dist/dataParser/extended/object.mjs +8 -13
- package/dist/dataParser/identifier.d.ts +40 -40
- package/dist/dataParser/index.cjs +4 -0
- package/dist/dataParser/index.mjs +2 -0
- package/dist/dataParser/parsers/array/index.cjs +2 -2
- package/dist/dataParser/parsers/array/index.mjs +2 -2
- package/dist/dataParser/parsers/literal.d.ts +1 -1
- package/dist/dataParser/parsers/object/index.cjs +3 -3
- package/dist/dataParser/parsers/object/index.d.ts +2 -0
- package/dist/dataParser/parsers/object/index.mjs +3 -3
- package/dist/dataParser/parsers/object/partial.cjs +20 -0
- package/dist/dataParser/parsers/object/partial.d.ts +14 -0
- package/dist/dataParser/parsers/object/partial.mjs +18 -0
- package/dist/dataParser/parsers/object/required.cjs +20 -0
- package/dist/dataParser/parsers/object/required.d.ts +10 -0
- package/dist/dataParser/parsers/object/required.mjs +18 -0
- package/dist/dataParser/parsers/record/index.cjs +2 -2
- package/dist/dataParser/parsers/record/index.mjs +2 -2
- package/dist/dataParser/parsers/recover.d.ts +1 -1
- package/dist/dataParser/parsers/refine.d.ts +1 -1
- package/dist/dataParser/parsers/tuple.cjs +2 -2
- package/dist/dataParser/parsers/tuple.mjs +2 -2
- package/dist/date/index.cjs +8 -0
- package/dist/date/index.d.ts +4 -0
- package/dist/date/index.mjs +4 -0
- package/dist/date/is.cjs +9 -0
- package/dist/date/is.d.ts +2 -0
- package/dist/date/is.mjs +7 -0
- package/dist/date/max.cjs +10 -0
- package/dist/date/max.d.ts +3 -0
- package/dist/date/max.mjs +8 -0
- package/dist/date/min.cjs +10 -0
- package/dist/date/min.d.ts +3 -0
- package/dist/date/min.mjs +8 -0
- package/dist/date/sort.cjs +20 -0
- package/dist/date/sort.d.ts +4 -0
- package/dist/date/sort.mjs +18 -0
- package/dist/generator/reduce.cjs +2 -6
- package/dist/generator/reduce.d.ts +1 -0
- package/dist/generator/reduce.mjs +2 -6
- package/dist/index.cjs +3 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +3 -1
- package/dist/number/index.cjs +2 -0
- package/dist/number/index.d.ts +1 -0
- package/dist/number/index.mjs +1 -0
- package/dist/number/max.cjs +2 -7
- package/dist/number/max.d.ts +2 -2
- package/dist/number/max.mjs +2 -7
- package/dist/number/min.cjs +2 -7
- package/dist/number/min.d.ts +2 -2
- package/dist/number/min.mjs +2 -7
- package/dist/number/sort.cjs +14 -0
- package/dist/number/sort.d.ts +3 -0
- package/dist/number/sort.mjs +12 -0
- package/dist/pattern/when.d.ts +5 -5
- package/dist/string/index.cjs +2 -0
- package/dist/string/index.d.ts +1 -0
- package/dist/string/index.mjs +1 -0
- package/dist/{array/sort/string.cjs → string/sort.cjs} +6 -6
- package/dist/string/sort.d.ts +3 -0
- package/dist/{array/sort/string.mjs → string/sort.mjs} +6 -6
- package/package.json +7 -2
- package/dist/array/sort/number.cjs +0 -14
- package/dist/array/sort/number.d.ts +0 -4
- package/dist/array/sort/number.mjs +0 -12
- package/dist/array/sort/string.d.ts +0 -4
- package/dist/common/not.cjs +0 -12
- package/dist/common/not.d.ts +0 -2
- package/dist/common/not.mjs +0 -10
- /package/dist/array/{sort/default.cjs → sort.cjs} +0 -0
- /package/dist/array/{sort/default.d.ts → sort.d.ts} +0 -0
- /package/dist/array/{sort/default.mjs → sort.mjs} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function sort(...args) {
|
|
4
4
|
if (args.length === 1) {
|
|
5
|
-
const [
|
|
6
|
-
return (array) =>
|
|
5
|
+
const [type] = args;
|
|
6
|
+
return (array) => sort(array, type);
|
|
7
7
|
}
|
|
8
|
-
const [array,
|
|
9
|
-
return [...array].sort(
|
|
8
|
+
const [array, type] = args;
|
|
9
|
+
return [...array].sort(type === "DSC"
|
|
10
10
|
? (first, second) => {
|
|
11
11
|
if (first < second) {
|
|
12
12
|
return 1;
|
|
@@ -21,4 +21,4 @@ function sortString(...args) {
|
|
|
21
21
|
: undefined);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
exports.
|
|
24
|
+
exports.sort = sort;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type SortType } from "../common";
|
|
2
|
+
export declare function sort<GenericArray extends readonly string[]>(type: SortType): (array: GenericArray) => string[];
|
|
3
|
+
export declare function sort<GenericArray extends readonly string[]>(array: GenericArray, type: SortType): string[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function sort(...args) {
|
|
2
2
|
if (args.length === 1) {
|
|
3
|
-
const [
|
|
4
|
-
return (array) =>
|
|
3
|
+
const [type] = args;
|
|
4
|
+
return (array) => sort(array, type);
|
|
5
5
|
}
|
|
6
|
-
const [array,
|
|
7
|
-
return [...array].sort(
|
|
6
|
+
const [array, type] = args;
|
|
7
|
+
return [...array].sort(type === "DSC"
|
|
8
8
|
? (first, second) => {
|
|
9
9
|
if (first < second) {
|
|
10
10
|
return 1;
|
|
@@ -19,4 +19,4 @@ function sortString(...args) {
|
|
|
19
19
|
: undefined);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { sort };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duplojs/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.19",
|
|
4
4
|
"author": "mathcovax",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -86,6 +86,11 @@
|
|
|
86
86
|
"import": "./dist/date/index.mjs",
|
|
87
87
|
"require": "./dist/date/index.cjs",
|
|
88
88
|
"types": "./dist/date/index.d.ts"
|
|
89
|
+
},
|
|
90
|
+
"./clean": {
|
|
91
|
+
"import": "./dist/clean/index.mjs",
|
|
92
|
+
"require": "./dist/clean/index.cjs",
|
|
93
|
+
"types": "./dist/clean/index.d.ts"
|
|
89
94
|
}
|
|
90
95
|
},
|
|
91
96
|
"files": [
|
|
@@ -107,7 +112,7 @@
|
|
|
107
112
|
"rollup-plugin-tsc-alias": "1.1.4",
|
|
108
113
|
"tslib": "2.8.1",
|
|
109
114
|
"tsx": "4.20.5",
|
|
110
|
-
"typescript": "5.9.
|
|
115
|
+
"typescript": "5.9.3",
|
|
111
116
|
"vite-tsconfig-paths": "5.1.4",
|
|
112
117
|
"vitest": "3.2.4"
|
|
113
118
|
},
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function sortNumber(...args) {
|
|
4
|
-
if (args.length === 1) {
|
|
5
|
-
const [sort] = args;
|
|
6
|
-
return (array) => sortNumber(array, sort);
|
|
7
|
-
}
|
|
8
|
-
const [array, sort] = args;
|
|
9
|
-
return [...array].sort(sort === "dsc"
|
|
10
|
-
? (first, second) => second - first
|
|
11
|
-
: (first, second) => first - second);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.sortNumber = sortNumber;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
type Sort = "asc" | "dsc";
|
|
2
|
-
export declare function sortNumber<GenericArray extends readonly number[]>(sort: Sort): (array: GenericArray) => number[];
|
|
3
|
-
export declare function sortNumber<GenericArray extends readonly number[]>(array: GenericArray, sort: Sort): number[];
|
|
4
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
function sortNumber(...args) {
|
|
2
|
-
if (args.length === 1) {
|
|
3
|
-
const [sort] = args;
|
|
4
|
-
return (array) => sortNumber(array, sort);
|
|
5
|
-
}
|
|
6
|
-
const [array, sort] = args;
|
|
7
|
-
return [...array].sort(sort === "dsc"
|
|
8
|
-
? (first, second) => second - first
|
|
9
|
-
: (first, second) => first - second);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { sortNumber };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
type Sort = "asc" | "dsc";
|
|
2
|
-
export declare function sortString<GenericArray extends readonly string[]>(sort: Sort): (array: GenericArray) => string[];
|
|
3
|
-
export declare function sortString<GenericArray extends readonly string[]>(array: GenericArray, sort: Sort): string[];
|
|
4
|
-
export {};
|
package/dist/common/not.cjs
DELETED
package/dist/common/not.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare function not<GenericInput extends unknown, GenericPredicatedInput extends GenericInput>(predicate: (input: GenericInput) => input is GenericPredicatedInput): (input: GenericInput) => input is Exclude<GenericInput, GenericPredicatedInput>;
|
|
2
|
-
export declare function not<GenericInput extends unknown, GenericPredicatedInput extends GenericInput>(input: GenericInput, predicate: (input: GenericInput) => input is GenericPredicatedInput): input is Exclude<GenericInput, GenericPredicatedInput>;
|
package/dist/common/not.mjs
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|