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

object-map

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

object-map

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

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
451
increased by12.19%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 21 Jun 2016

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