basant307/AI_Governance_Project
048
1import apply from './_apply.js';2import arrayMap from './_arrayMap.js';3import unzip from './unzip.js';4 5/**6 * This method is like `_.unzip` except that it accepts `iteratee` to specify7 * how regrouped values should be combined. The iteratee is invoked with the8 * elements of each group: (...group).9 *10 * @static11 * @memberOf _12 * @since 3.8.013 * @category Array14 * @param {Array} array The array of grouped elements to process.15 * @param {Function} [iteratee=_.identity] The function to combine16 * regrouped values.17 * @returns {Array} Returns the new array of regrouped elements.18 * @example19 *20 * var zipped = _.zip([1, 2], [10, 20], [100, 200]);21 * // => [[1, 10, 100], [2, 20, 200]]22 *23 * _.unzipWith(zipped, _.add);24 * // => [3, 30, 300]25 */26function unzipWith(array, iteratee) {27 if (!(array && array.length)) {28 return [];29 }30 var result = unzip(array);31 if (iteratee == null) {32 return result;33 }34 return arrayMap(result, function(group) {35 return apply(iteratee, undefined, group);36 });37}38 39export default unzipWith;40 