@cofondateurauchomage/libs 1.1.50 → 1.1.51

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.
@@ -6,3 +6,7 @@ export declare function includes<T extends string>(array: T[], value: string): v
6
6
  * Retourne un array sans valeurs null ou undefined
7
7
  */
8
8
  export declare const compact: <T>(array: (T | null | undefined)[]) => T[];
9
+ /**
10
+ * Divise un tableau en lots de taille maximale
11
+ */
12
+ export declare function chunkArray<T>(array: T[], size: number): T[][];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compact = exports.includes = void 0;
3
+ exports.chunkArray = exports.compact = exports.includes = void 0;
4
4
  /**
5
5
  * Includes typé
6
6
  */
@@ -13,3 +13,14 @@ exports.includes = includes;
13
13
  */
14
14
  const compact = (array) => array.filter(Boolean);
15
15
  exports.compact = compact;
16
+ /**
17
+ * Divise un tableau en lots de taille maximale
18
+ */
19
+ function chunkArray(array, size) {
20
+ const result = [];
21
+ for (let i = 0; i < array.length; i += size) {
22
+ result.push(array.slice(i, i + size));
23
+ }
24
+ return result;
25
+ }
26
+ exports.chunkArray = chunkArray;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofondateurauchomage/libs",
3
- "version": "1.1.50",
3
+ "version": "1.1.51",
4
4
  "description": "",
5
5
  "main": "build/index",
6
6
  "scripts": {