Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atomic-app/map-obj

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomic-app/map-obj

Browser-friendly fork of sindresorhus/map-obj

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
968
decreased by-3.2%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 02 May 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc