@punks/backend-core 0.0.56 → 0.0.58
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/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/utils/array.d.ts +1 -0
- package/dist/cjs/types/utils/paths.d.ts +1 -0
- package/dist/esm/index.js +12 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/utils/array.d.ts +1 -0
- package/dist/esm/types/utils/paths.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -63,6 +63,17 @@ const toItemsDict = (array, keySelector, elementSelector) => {
|
|
|
63
63
|
}
|
|
64
64
|
return data;
|
|
65
65
|
};
|
|
66
|
+
const toArrayDict = (array, keySelector) => {
|
|
67
|
+
const data = {};
|
|
68
|
+
for (const item of array) {
|
|
69
|
+
const key = keySelector(item);
|
|
70
|
+
if (!data[key]) {
|
|
71
|
+
data[key] = [];
|
|
72
|
+
}
|
|
73
|
+
data[key].push(item);
|
|
74
|
+
}
|
|
75
|
+
return data;
|
|
76
|
+
};
|
|
66
77
|
const toMap = (array, key) => {
|
|
67
78
|
const map = new Map();
|
|
68
79
|
array.forEach((x) => map.set(key(x), x));
|
|
@@ -28696,6 +28707,7 @@ exports.sort = sort;
|
|
|
28696
28707
|
exports.splitPath = splitPath;
|
|
28697
28708
|
exports.subArrays = subArrays;
|
|
28698
28709
|
exports.subtractTime = subtractTime;
|
|
28710
|
+
exports.toArrayDict = toArrayDict;
|
|
28699
28711
|
exports.toCamelCase = toCamelCase;
|
|
28700
28712
|
exports.toDict = toDict;
|
|
28701
28713
|
exports.toItemsDict = toItemsDict;
|