imagic-utils 1.0.0 → 1.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imagic-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Utils package",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import getRandArrayItem from './utils/array/getRandArrayItem.js'
2
+ import chunkArray from './utils/array/chunkArray.js'
2
3
  import getRandFloat from './utils/float/getRandFloat.js'
3
4
  import chance from './utils/general/chance.js'
4
5
  import generateBigId from './utils/general/generateBigId.js'
@@ -15,6 +16,7 @@ import getRandString from './utils/string/getRandString.js'
15
16
 
16
17
  export default {
17
18
  getRandArrayItem,
19
+ chunkArray,
18
20
  getRandFloat,
19
21
  chance,
20
22
  generateBigId,
@@ -0,0 +1,9 @@
1
+ export default (array, chunkSize) => {
2
+ const result = []
3
+
4
+ for (let i = 0; i < array.length; i += chunkSize) {
5
+ result.push(array.slice(i, i + chunkSize))
6
+ }
7
+
8
+ return result
9
+ }