New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

map-to-map

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

map-to-map

Map an object (or Map) to a Map.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

map-to-map

Map an object (or Map) to a Map.

Install

$ yarn add map-to-map

Usage

const mapToMap = require('map-to-map');

const map = mapToMap({propOne: 10, propTwo: 20}, (value) => value * value);
// Returns 100.
map.get('propOne');

API

mapToMap(object, mapper)

Returns a Map whose values are made from running the properties of object through mapper. If object is a Map, it'll map its entries, instead.

object

  • Type: object | Map

An object or Map.

mapper(value, key)

  • Type: Function

An optional mapper function.

License

MIT © Matthew Fernando Garcia

Keywords

map

FAQs

Package last updated on 12 Oct 2020

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