There was an error while loading. Please reload this page.
Count occurrences of values.
Similar: count, countAs.
function countAs(x, fm) // x: an object // fm: map function (v, k, x)
const object = require('extra-object'); var x = {a: 1, b: 1, c: 2, d: 2, e: 4}; object.countAs(x); // → Map(3) { 1 => 2, 2 => 2, 4 => 1 } var x = {a: 1, b: 2, c: 3, d: 4}; object.countAs(x, v => v % 2); // → Map(2) { 1 => 2, 0 => 2 }