2.0.0 • Published 4 years ago

map-to-map v2.0.0

Weekly downloads
19
License
MIT
Repository
github
Last release
4 years ago

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

2.0.0

4 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago