0.2.0 • Published 5 years ago

map-entries v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

map-entries

.map() for objects

Map over an object, alter it's keys and values and return a new object.

Installation

npm install map-entries --save

Usage example

import mapEntries from 'map-entries'

const myObject = {
  type: 'Apple',
  color: 'Red'
}

const mappedObject = mapEntries(myObject, ({key, value}, i) => ({
  [`${key}_${i}`]: value
}))

console.log(mappedObject)
//=>
{
  '0_type': 'Apple',
  '1_color': 'Red'
}

License

Distributed under the MIT license

0.2.0

5 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago