@extra-entries/count.min

Counts values which satisfy a test. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraEntriesCountMin from 'https://cdn.skypack.dev/@extra-entries/count.min';
</script>

README

Counts values which satisfy a test. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: count, countAs.

This is part of package extra-entries.

This is browserified, minified version of @extra-entries/count.
It is exported as global variable entries_count.
CDN: unpkg, jsDelivr.


entries.count(x, ft);
// x:  a map
// ft: test function (v, k, x)
const entries = require("extra-entries");

var x = [["a", 1], ["b", 1], ["c", 2], ["d", 2], ["e", 4]];
entries.count(x, v => v % 2 === 1);
// 2

entries.count(x, v => v % 2 === 0);
// 3


References