Files
lodash/_baseZipObject.js
2017-01-08 23:37:20 -08:00

24 lines
666 B
JavaScript

/**
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
* @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
*/
function baseZipObject(props, values, assignFunc) {
let index = -1;
const length = props.length;
const valsLength = values.length;
const result = {};
while (++index < length) {
const value = index < valsLength ? values[index] : undefined;
assignFunc(result, props[index], value);
}
return result;
}
export default baseZipObject;