1.1.1 • Published 5 years ago

@extra-map/pick-values v1.1.1

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

Filter map with values of specified keys, like _.pick().

const pickValues = require('@extra-map/pick-values');
// pickValues(<map>, <keys>, [begin=0], [end], [target=[]], [at])
// -> <target>

var m = new Map([['i', 9], ['n', 14], ['c', 3]]);
pickValues(m, ['n', 'i']);
// [14, 9]
pickValues(m, ['n', 'i', 'c'], 1);
// [9, 3]
pickValues(m, ['n', 'i', 'c'], 1, 2);
// [9]
pickValues(m, ['n', 'i', 'c'], 1, 2, [10, 11]);
// [10, 11, 9]
pickValues(m, ['n', 'i', 'c'], 1, 2, [10, 11], 1);
// [10, 9]

extra-map