Files
lodash/zipObject.js
John-David Dalton 7293d39642 Bump to v4.1.0.
2016-01-29 01:14:13 -08:00

24 lines
660 B
JavaScript

define(['./_assignValue', './_baseZipObject'], function(assignValue, baseZipObject) {
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property names and one of corresponding values.
*
* @static
* @memberOf _
* @category Array
* @param {Array} [props=[]] The property names.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
return zipObject;
});