zipObjectDeep.js 643 B

123456789101112131415161718192021222324
  1. var baseSet = require('./_baseSet'),
  2. baseZipObject = require('./_baseZipObject');
  3. /**
  4. * This method is like `_.zipObject` except that it supports property paths.
  5. *
  6. * @static
  7. * @memberOf _
  8. * @since 4.1.0
  9. * @category Array
  10. * @param {Array} [props=[]] The property identifiers.
  11. * @param {Array} [values=[]] The property values.
  12. * @returns {Object} Returns the new object.
  13. * @example
  14. *
  15. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  16. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  17. */
  18. function zipObjectDeep(props, values) {
  19. return baseZipObject(props || [], values || [], baseSet);
  20. }
  21. module.exports = zipObjectDeep;