Socket
Socket
Sign inDemoInstall

object-map

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    object-map

Map a function over some Object's values to produce a new Object.


Version published
Weekly downloads
429
decreased by-40.75%
Maintainers
1
Install size
3.56 kB
Created
Weekly downloads
 

Readme

Source

Map a function over the values of an Object to produce a new Object with the same keys.

The API is modelled after the native Array#map method.

Installation

$ npm install --save object-map

Example

var objectMap = require('object-map');

var target = {
  foo: 1,
  bar: 2
};

var result = objectMap(target, function(value) {
  return value * value;
});
// => {foo: 1, bar: 4}

API

objectMap(target, callback[, thisArg])

  • target an object who's properties are iterated using hasOwnProperty
  • callback a function producing a value of the new Object, taking three arguments:
    • currentValue the value currently associated with the key
    • key the current key
    • object the original object passed to objectMap
  • thisArg Optional. Value to use as this when executing callback.

License

MIT

Keywords

FAQs

Last updated on 21 Jun 2016

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