1.1.1 • Published 6 years ago

map-value v1.1.1

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
6 years ago

map-value

Map object key/value into new object, but let you alter/delete some keys using functions

npm Build Status

Install

npm install --save map-value

Usage

Simple One

mapValue({a:1, b:2}, {b: v=>v*2})
// {a:1, b:4}

Complex One

const newObject = mapValue(
    {a:1,b:2},
    {
      a: value => ({c:3}),
      x: (value, key) => ({x:value, k:key, d: 1234})
    }
)

Result:

{
  b: 2,
  c: 3,
  x: undefined,
  k: 'x',
  d: 1234
}
1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago