-
Notifications
You must be signed in to change notification settings - Fork 0
map
Subhajit Sahu edited this page May 7, 2020
·
15 revisions
Map values in entries to new values, like Array.map().
const map = require('@extra-entries/map');
// map(<entries>, <map function>, [this], [begin=0], [end], [target=[]], [at])
// - <map function>(<value>, <key>, <entries>)
// -> <target>
map(['WorldWideWeb', 'Mosaic', 'Netscape Navigator'].entries(), (v) => v.toLowerCase());
// [[0, 'worldwideweb'], [1, 'mosaic'], [2, 'netscape navigator']]
map(new Set().add('Internet Explorer').add('Opera').entries(), (v, k, ent) => v.toLowerCase());
// [['Internet Explorer', 'internet explorer'], ['Opera', 'opera']]
map(new Map().set(2002, 'Mozilla Navigator').set(2003, 'Safari').entries(), (v, k, ent) => v.toLowerCase());
// [[2002, 'mozilla navigator'], [2003, 'safari']]