0.4.1 • Published 8 years ago

@vutran/object-map v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

object-map

map function for JavaScript objects.

Travis

Install

$ npm install --save @vutran/object-map

Usage

import objectMap from '@vutran/object-map';

const myObject = {
  firstName: 'Vu',
  lastName: 'Tran',
};

const newObject = objectMap(myObject, function(value, prop, arr) {
  return value + '!';
});

console.log(newObject);
// => { firstName: 'Vu!', lastName: 'Tran!' };

API

objectMap(object, callback)

Returns a new object and applies the callback for each property in the given object.

objectMap

Type: object

The reference object

callback

Type: function

Function that produces a value for a given property. Takes 3 arguments: value, prop, object.

value: The value of the current property prop: The name of the property object: The original object

License

MIT © Vu Tran

0.4.1

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago