time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

zipObject.js (664B)


      1 var assignValue = require('./_assignValue'),
      2     baseZipObject = require('./_baseZipObject');
      3 
      4 /**
      5  * This method is like `_.fromPairs` except that it accepts two arrays,
      6  * one of property identifiers and one of corresponding values.
      7  *
      8  * @static
      9  * @memberOf _
     10  * @since 0.4.0
     11  * @category Array
     12  * @param {Array} [props=[]] The property identifiers.
     13  * @param {Array} [values=[]] The property values.
     14  * @returns {Object} Returns the new object.
     15  * @example
     16  *
     17  * _.zipObject(['a', 'b'], [1, 2]);
     18  * // => { 'a': 1, 'b': 2 }
     19  */
     20 function zipObject(props, values) {
     21   return baseZipObject(props || [], values || [], assignValue);
     22 }
     23 
     24 module.exports = zipObject;