@supercharge/arrays
Advanced tools
Changelog
4.1.0 - 2022-11-02
reject
method: inverse of filter
, removing all items satisfying the provided callback functionunique
method: keep only unique items in the arrayuniqueBy
method: keep only unique items in the array identified by a given selector
functionisIterable
now checks whether the given input implements a Symbol.iterator
functionChangelog
4.0.0 - 2022-08-08
append
method: an alias for the push
method, adding an item to the end of the arrayprepend
method: an alias for the unshift
method, adding an item to the beginning of the arrayChangelog
3.2.0 - 2022-05-06
groupBy
const products = [
{ name: 'Macbook', price: 2500 },
{ name: 'Macbook', price: 3000 },
{ name: 'iPhone', price: 1000 }
]
Arr.from(products).groupBy(product => {
return product.name
})
// Macbook: [
// { name: 'Macbook', price: 2500 },
// { name: 'Macbook', price: 3000 }
// ],
// iPhone: [
// { name: 'iPhone', price: 1000 }
// ]
Changelog
3.0.0 - 2022-03-12
Arr.from
with strings will wrap the string values into an array instead of creating an array of the string’s individual charactersdiff
method