Arrays
Unlock the Power of Arrays with Nexium's Essential Methods
const { NArray } = require('nexium')
splits array into chunks of specified length
const arr = [1, 2, 3, 4, 5, 6, 7]
const chunkLength = 3
const result = NArray.chunkArray(arr, chunkLength) // [[1, 2, 3], [4, 5, 6], [7]]
remove duplicates from the given array.
const array = [{ id: 1 }, { id: 2 }, { id: 1 }]
const result = NArray.uniqueArray(array) // [{ id: 1 }, { id: 2 }]
remove duplicates from the given array.
const str_result = NArray.countNonRepeating(['a', 'b', 'b', 'c', 'd', 'd', 'e'], 'string') // 3
const num_result = NArray.countNonRepeating([1, 2, 2, 3, 4, 4, 5], 'number') // 3