@extra-object/count.min

Counts values which satisfy a test.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-object/count.min
002.2.52 years ago3 years agoMinified + gzip package size for @extra-object/count.min in KB

Readme

Counts values which satisfy a test. :running: :vhs: :package: :moon: :ledger:
Alternatives: count, countAs.
This is part of package extra-object.

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

object.count(x, ft);
// x:  an object
// ft: test function (v, k, x)

const object = require('extra-object');

var x = {a: 1, b: 1, c: 2, d: 2, e: 4};
object.count(x, v => v % 2 === 1);
// 2

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

references