Skip to content

futurist/map-value

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published