@crapthings/lodash-count-elements

0.0.3 • Public • Published

lodash-count-elements

Usage

npm i @crapthings/lodash-count-elements
const countels = require('@crapthings/lodash-count-elements')
const array = ['a', 'b', 'c', 'b', 'c', 'c']
console.log(countels(array))
console.log(countels(array, { order: 'desc' })) //default
console.log(countels(array, { order: 'asc' }))
const countels = require('@crapthings/lodash-count-elements')
const example = ['a', 'b', 'c', 'd', 'a', 'a', 'a', 'b', 'e', 'f', 'c', 'c', 'c', 'a']
const test = countels(example, {
  take: 2,
  reject: ({ key, value }, k) => {
    if (key === 'a') return true
  }
})

console.log(test)
[ { key: 'c', value: 4 }, { key: 'b', value: 2 } ]

Readme

Keywords

Package Sidebar

Install

npm i @crapthings/lodash-count-elements

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

2.02 kB

Total Files

4

Last publish

Collaborators

  • crapthings