Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

readme.md 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # map-obj
  2. > Map object keys and values into a new object
  3. ## Install
  4. ```
  5. $ npm install map-obj
  6. ```
  7. ## Usage
  8. ```js
  9. const mapObject = require('map-obj');
  10. const newObject = mapObject({foo: 'bar'}, (key, value) => [value, key]);
  11. //=> {bar: 'foo'}
  12. const newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value]);
  13. //=> {foo: true, bar: {bAz: true}}
  14. const newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value], {deep: true});
  15. //=> {foo: true, bar: {baz: true}}
  16. ```
  17. ## API
  18. ### mapObject(source, mapper, options?)
  19. #### source
  20. Type: `object`
  21. Source object to copy properties from.
  22. #### mapper
  23. Type: `(sourceKey, sourceValue, source) => [targetKey, targetValue, mapperOptions?]`
  24. Mapping function.
  25. ##### mapperOptions
  26. ###### shouldRecurse
  27. Type: `boolean`\
  28. Default: `true`
  29. Whether `targetValue` should be recursed. Requires `deep: true`.
  30. #### options
  31. Type: `object`
  32. ##### deep
  33. Type: `boolean`\
  34. Default: `false`
  35. Recurse nested objects and objects in arrays.
  36. ##### target
  37. Type: `object`\
  38. Default: `{}`
  39. Target object to map properties on to.
  40. ## Related
  41. - [filter-obj](https://github.com/sindresorhus/filter-obj) - Filter object keys and values into a new object
  42. ---
  43. <div align="center">
  44. <b>
  45. <a href="https://tidelift.com/subscription/pkg/npm-map-obj?utm_source=npm-map-obj&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
  46. </b>
  47. <br>
  48. <sub>
  49. Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
  50. </sub>
  51. </div>