npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

set-map

2.0.0

@sindresorhus

npmHomeRepoSnykSocket
Downloads:106
$ npm install set-map
DailyWeeklyMonthlyYearly

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.