Socket
Book a DemoInstallSign in
Socket

set-map

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-map

Map over a `Set`

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

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.

Keywords

set

FAQs

Package last updated on 03 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts