@extra-map/count-as.min
TypeScript icon, indicating that this package has built-in type declarations

2.2.15 • Public • Published

Counts occurrences of values. 📦 😺 🏃 📼 🌔 📜 📰 📘

Alternatives: count, countAs.

This is part of package extra-map.

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


map.countAs(x, fm);
// x:  a map
// fm: map function (v, k, x)
// → Map {value => count}
const map = require("extra-map");

var x = new Map([["a", 1], ["b", 1], ["c", 2], ["d", 2], ["e", 4]]);
map.countAs(x);
// Map(3) { 1 => 2, 2 => 2, 4 => 1 }

var x = new Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
map.countAs(x, v => v % 2);
// Map(2) { 1 => 2, 0 => 2 }


References

Install

npm i @extra-map/count-as.min

DownloadsWeekly Downloads

2

Version

2.2.15

License

MIT

Unpacked Size

5.33 kB

Total Files

7

Last publish

Collaborators

  • wolfram77