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

obj-map-prop

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obj-map-prop

Map object properties by a dict of map functions

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

obj-map-prop unstable

Map object properties by a dict of functions.

npm install obj-map-prop

let map = require('obj-map-prop')

let obj = {propA: '0', propB: 1, propC: 'foo', propD: 'bar'}
let result = map(obj, {
	propA: value => +value,
	propB: value => value + 1,
	propC: c => typeof c === 'function' ? c() : c
})
// {propA: 0, propB: 2, propC: 'foo'}


// keep rest of properties
let result = map(obj, {
  propA: value => +value
}, true)
// {propA: 0, propB: 1, propC: 'foo', propD: 'bar'}

Credits

© 2017 Dima Yv. MIT License

Keywords

obj-map-prop

FAQs

Package last updated on 02 Apr 2019

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