@extra-map/filter-update.min

Keeps entries which pass a test.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-map/filter-update.min
312.2.152 years ago2 years agoMinified + gzip package size for @extra-map/filter-update.min in KB

Readme

Keeps entries which pass a test. :package: :smileycat: :running: :vhs: :moon: :scroll: :newspaper: :bluebook:
Alternatives: filter, filter$.
Similar: map, reduce, filter, filterAt, reject, rejectAt.

This is part of package extra-map.

This is browserified, minified version of @extra-map/filter-update.
It is exported as global variable mapfilter$.
CDN: unpkg
, jsDelivr.



map.filter$(x, ft);
// x:  an map (updated)
// ft: test function (v, k, x)
// → x

const map = require("extra-map");

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

x;
// Map(3) { "a" => 1, "c" => 3, "e" => 5 }

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