@8ms/helpers 2.3.10 → 2.3.12
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/.yarn/install-state.gz +0 -0
- package/dist/lodash/index.d.mts +10 -1
- package/dist/lodash/index.mjs +29 -1
- package/dist/util/index.d.mts +1 -1
- package/dist/util/index.mjs +1 -2
- package/package.json +1 -1
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/dist/lodash/index.d.mts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
//#region src/lodash/chunk.d.ts
|
|
2
|
+
declare const chunk: <T>(array: T[], size: number) => T[][];
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/lodash/flatten.d.ts
|
|
5
|
+
declare const flatten: <T>(array: T[][]) => T[];
|
|
6
|
+
//#endregion
|
|
1
7
|
//#region src/lodash/set.d.ts
|
|
2
8
|
declare const set: <T extends object>(obj: T, path: string | string[], value: unknown) => T;
|
|
3
9
|
//#endregion
|
|
@@ -30,4 +36,7 @@ declare const unescape: (str: string) => string;
|
|
|
30
36
|
//#region src/lodash/uniq.d.ts
|
|
31
37
|
declare const uniq: (arr: any[]) => any[];
|
|
32
38
|
//#endregion
|
|
33
|
-
|
|
39
|
+
//#region src/lodash/uniqBy.d.ts
|
|
40
|
+
declare const uniqBy: <T>(collection: T[], iteratee: ((item: T) => unknown) | string) => T[];
|
|
41
|
+
//#endregion
|
|
42
|
+
export { chunk, flatten, isDate, isEmpty, isEqual, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
|
package/dist/lodash/index.mjs
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
//#region src/lodash/chunk.ts
|
|
2
|
+
const chunk = (array, size) => {
|
|
3
|
+
const result = [];
|
|
4
|
+
for (let i = 0; i < array.length; i += size) result.push(array.slice(i, i + size));
|
|
5
|
+
return result;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/lodash/flatten.ts
|
|
10
|
+
const flatten = (array) => [].concat(...array);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
1
13
|
//#region src/lodash/set.ts
|
|
2
14
|
const set = (obj, path, value) => {
|
|
3
15
|
if (obj == null) return obj;
|
|
@@ -141,4 +153,20 @@ const unescape = (str) => {
|
|
|
141
153
|
const uniq = (arr) => [...new Set(arr)];
|
|
142
154
|
|
|
143
155
|
//#endregion
|
|
144
|
-
|
|
156
|
+
//#region src/lodash/uniqBy.ts
|
|
157
|
+
const uniqBy = (collection, iteratee) => {
|
|
158
|
+
const seen = /* @__PURE__ */ new Set();
|
|
159
|
+
const getValue = (item) => {
|
|
160
|
+
if (typeof iteratee === "function") return iteratee(item);
|
|
161
|
+
return iteratee.split(".").reduce((acc, part) => acc?.[part], item);
|
|
162
|
+
};
|
|
163
|
+
return collection.filter((item) => {
|
|
164
|
+
const key = getValue(item);
|
|
165
|
+
if (seen.has(key)) return false;
|
|
166
|
+
seen.add(key);
|
|
167
|
+
return true;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
export { chunk, flatten, isDate, isEmpty, isEqual, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
|
package/dist/util/index.d.mts
CHANGED
|
@@ -39,7 +39,7 @@ declare const isUndefined: (instance: any, keys: any | any[]) => boolean;
|
|
|
39
39
|
* Chunk a queue of promises into controlled chunks to prevent overloading.
|
|
40
40
|
* https://stackoverflow.com/a/53964407
|
|
41
41
|
*/
|
|
42
|
-
declare const promiseChunks: (promises: Promise<any>[], size: number, sleepSeconds?: number, callbackFunction?: Function) => Promise<
|
|
42
|
+
declare const promiseChunks: (promises: Promise<any>[], size: number, sleepSeconds?: number, callbackFunction?: Function) => Promise<unknown[]>;
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/util/sleep.d.ts
|
|
45
45
|
declare const sleep: (seconds: number) => Promise<void>;
|
package/dist/util/index.mjs
CHANGED