Socket
Socket
Sign inDemoInstall

@atomic-app/map-obj

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @atomic-app/map-obj

Browser-friendly fork of sindresorhus/map-obj


Version published
Weekly downloads
1.1K
increased by47.5%
Maintainers
1
Install size
2.23 MB
Created
Weekly downloads
 

Readme

Source

map-obj Build Status

Map object keys and values into a new object

Note: This is a browser-friendly fork of sindresorhus/map-obj.

Install

$ npm install --save map-obj

Usage

const mapObj = require('map-obj');

const newObject = mapObj({foo: 'bar'}, (key, value) => [value, key]);
//=> {bar: 'foo'}

API

mapObj(source, mapper, [options])

source

Type: Object

Source object to copy properties from.

mapper

Type: Function

Mapping function.

  • It has signature mapper(sourceKey, sourceValue, source).
  • It must return a two item array: [targetKey, targetValue].
options

Type: Object

deep

Type: boolean
Default: false

Recurse nested objects and objects in arrays.

target

Type: Object
Default: {}

Target object to map properties on to.

  • filter-obj - Filter object keys and values into a new object
  • object-assign - Copy enumerable own properties from one or more source objects to a target object

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 02 May 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc