count-array-values 
Count the instances of each value in an array, ignoring any non-string values.
Installation
npm install count-array-values --save
Usage
var count = require('count-array-values')
count(['foo', 'bar', 'Bar', 451, 'bar', 'bar', 'baz', 'foo', null, undefined])
If you'd like to use a more relevant property name than value, specify it
as the second argument when calling the function:
count(['apple', 'banana', 'apple'], 'fruit')
You can also override the name of the count property:
const packages = ['express', 'lodash', 'express', 'lodash', 'express', 'banana']
count(packages, 'package', 'dependents')
Tests
npm install
npm test
Dependencies
None
Dev Dependencies
- standard: JavaScript Standard Style
- standard-markdown: Test your Markdown files for Standard JavaScript Style™
- tap-spec: Formatted TAP output like Mocha's spec reporter
- tape: tap-producing test harness for node and browsers
License
MIT