@contrail/util 1.0.51 → 1.0.52

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.
@@ -7,6 +7,7 @@ export { ObjectDiff } from './compareDeep/compareDeep';
7
7
  export declare class ObjectUtil {
8
8
  static getByPath(obj: any, path: string, def?: any): any;
9
9
  static setByPath(obj: any, path: string, value: any): void;
10
+ static chunk(array: any[], size: number): any[];
10
11
  static isObject: typeof isObject;
11
12
  static mergeDeep: typeof mergeDeep;
12
13
  static cloneDeep: typeof cloneDeep;
@@ -30,6 +30,13 @@ class ObjectUtil {
30
30
  }
31
31
  o[a[0]] = value;
32
32
  }
33
+ static chunk(array, size) {
34
+ const chunked = [];
35
+ for (let i = 0; i < array.length; i = i + size) {
36
+ chunked.push(array.slice(i, i + size));
37
+ }
38
+ return chunked;
39
+ }
33
40
  }
34
41
  exports.ObjectUtil = ObjectUtil;
35
42
  ObjectUtil.isObject = isObject_1.isObject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/util",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "General javascript utilities",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",