0.1.2 • Published 6 years ago

map-filterto v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

map-filterto

NOTE: map-filterto was renamed to @extra-map/filter. NPM

Filter values in map that pass the test, like Array.filter().

const filterTo = require('map-filterto');
// filterTo(<map>, <test function>, [this], [target=new Map()])
// -> <target>

var m = new Map([['m', 13], ['a', 1], ['p', 16]]);
filterTo(m, (v) => v>1);
// Map {'m'=>13, 'p'=>16}
filterTo(m, (v, k, map) => v>1, null, new Map([['s', 19]]));
// Map {'s'=>19, 'm'=>13, 'p'=>16}
filterTo(m, (v, k, map) => v>1, null, m);
// Map {'m'=>13, 'p'=>16}  (map "m" modified)
0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago