2.0.0 • Published 3 years ago

set-map v2.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

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.