Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.2 KiB

  1. # map-obj [![Build Status](https://travis-ci.org/sindresorhus/map-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/map-obj)
  2. > Map object keys and values into a new object
  3. ## Install
  4. ```
  5. $ npm install --save map-obj
  6. ```
  7. ## Usage
  8. ```js
  9. const mapObj = require('map-obj');
  10. const newObject = mapObj({foo: 'bar'}, (key, value) => [value, key]);
  11. //=> {bar: 'foo'}
  12. ```
  13. ## API
  14. ### mapObj(source, mapper, [options])
  15. #### source
  16. Type: `Object`
  17. Source object to copy properties from.
  18. #### mapper
  19. Type: `Function`
  20. Mapping function.
  21. - It has signature `mapper(sourceKey, sourceValue, source)`.
  22. - It must return a two item array: `[targetKey, targetValue]`.
  23. #### deep
  24. Type: `boolean`<br>
  25. Default: `false`
  26. Recurse nested objects and objects in arrays.
  27. #### target
  28. Type: `Object`<br>
  29. Default: `{}`
  30. Target object to map properties on to.
  31. ## Related
  32. - [filter-obj](https://github.com/sindresorhus/filter-obj) - Filter object keys and values into a new object
  33. - [object-assign](https://github.com/sindresorhus/object-assign) - Copy enumerable own properties from one or more source objects to a target object
  34. ## License
  35. MIT © [Sindre Sorhus](https://sindresorhus.com)