astro-ghostcms/.pnpm-store/v3/files/77/c7bf9ec8da9667d4430a5e887e9...

30 lines
555 B
Plaintext
Raw Permalink Normal View History

2024-02-14 14:10:47 +00:00
# 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)