set-map

2.0.0 • Public • Published

set-map

Map over a Set

Because Set is missing a Set#map method.

Install

$ npm install set-map

Usage

import setMap from 'set-map';

const set = new Set(['foo', 'bar']);

setMap(set, value => `yo${value}`).values();
//=> ['yofoo', 'yobar']

API

setMap(input, mapper)

input

Type: Set

The Set to map over.

mapper(element)

Type: function

Called for every element and should return the new element.

Package Sidebar

Install

npm i set-map

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

2.37 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus