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

2.10.19 • Public • Published

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

Alternatives: count, countAs.
Similar: count, partition.

This is part of package extra-array.

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


array.countAs(x, [fm]);
// x:  an array
// fm: map function (v, i, x)
// → Map {value => count}
const array = require("extra-array");

var x = [1, 1, 2, 2, 4];
array.countAs(x);
// Map(3) { 1 => 2, 2 => 2, 4 => 1 }

var x = [1, 2, 3, 4];
array.countAs(x, v => v % 2);
// Map(2) { 1 => 2, 0 => 2 }


References

Package Sidebar

Install

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

Weekly Downloads

0

Version

2.10.19

License

MIT

Unpacked Size

5.42 kB

Total Files

8

Last publish

Collaborators

  • wolfram77