object/mapKeys.js

  1. import _mapKeys from 'lodash/mapKeys'
  2. import { convert } from 'util/convert'
  3. /**
  4. * Replaces by an object with the same values as the former object and values generated by running each own enumerable string keyed property of the former object thru <code>iteratee</code>.
  5. * The iteratee is invoked with three arguments: (value, key, object).
  6. * @function
  7. * @memberof object
  8. * @param {Object} object The object to modify.
  9. * @param {Array|string} path The path of the property to set.
  10. * @param {function} [iteratee={@link https://lodash.com/docs#identity|lodash.identity}] The function invoked per iteration.
  11. * @return {Object} Returns the updated object.
  12. * @example mapKeys({ nested: { a: 1, b: 2, c: 3 } }, 'nested', (v, k) => '_' + k) // => { nested: { _a: 1, _b: 2, _c: 3 } }
  13. * @see {@link https://lodash.com/docs#mapKeys|lodash.mapKeys} for more information.
  14. * @since 0.3.0
  15. */
  16. const mapKeys = convert(_mapKeys)
  17. export { mapKeys, mapKeys as default }