array-occurrence

Get the number of occurrences of an item in an array

Usage no npm install needed!

<script type="module">
  import arrayOccurrence from 'https://cdn.skypack.dev/array-occurrence';
</script>

README

array-occurrence Build Status

Get the number of occurrences of an item in an array

Install

$ npm install --save array-occurrence

Usage

var arrayOccurrence = require('array-occurrence');

arrayOccurrence(['foo', 'bar', 'foo'], 'foo');
//=> 2

API

arrayOccurrence(input, search)

input

Type: array

Array to search in.

search

Type: Any type

Item to search for.

License

MIT © Andreas Gillström