Blame view

node_modules/map-obj/readme.md 555 Bytes
aaac7fed   liuqimichale   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  # map-obj [![Build Status](https://travis-ci.org/sindresorhus/map-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/map-obj)
  
  > Map object keys and values into a new object
  
  
  ## Install
  
  ```
  $ npm install --save map-obj
  ```
  
  
  ## Usage
  
  ```js
  var mapObj = require('map-obj');
  
  var newObject = mapObj({foo: 'bar'}, function (key, value, object) {
  	// first element is the new key and second is the new value
  	// here we reverse the order
  	return [value, key];
  });
  //=> {bar: 'foo'}
  ```
  
  
  ## License
  
  MIT © [Sindre Sorhus](http://sindresorhus.com)