Augment translate functions with params reduce functions

@param {Function} fn
@param {Array} keys
@return {Function}
556220
function augment(fn, keys) {
  keys = keys || fn.params || [];
  if (!Array.isArray(keys)) keys = Object.keys(keys);
  fn.params = keys;
  return fn;
}
1374945
function withPlugins(fn) {
  return function() {
    const args = Array.from(arguments);
    let plugins = (args[1] && args[1].plugins) || [];
    if (!isArray(plugins)) {
      plugins = Object.values(plugins);
    }
    args[1] = Object.assign({}, args[1], {
      plugins: internalPlugins.concat(plugins)
    });
    return fn.apply(null, args);
  };
}
653871
function wrapFunctions(fns, file, files) {
  return Object.entries(fns)
    .reduce((obj1, [groupName, group]) => {
      return Object.assign(obj1, {
        [groupName]: Object.entries(group)
          .reduce((obj2, [fnName, fn]) => {
            return Object.assign(obj2, { [fnName]: fn(file, files) });
          }, {})
      });
    }, {});
}
565555
function makeTranslation (original, replacement) {
    let translation = new Map()
    Array.prototype.forEach.call(original, function setMap (source, index) {
      translation.set(source, replacement[index] || '')
    })

    return function (string) {
      return Array.prototype.map.call(string, function replace (ch) {
        return translation.has(ch) ? translation.get(ch) : ch
      }).join('')
    }
  }
1002773
function makeLocalizeFunction(localization, nested) {
  return function localizeFunction(key) {
    return nested ? byString(localization, key) : localization[key];
  };
}
1016618
@SuppressWarnings("unchecked")
  public void reduceToKeys(Set<String> keys) {
    if (size > 0) {
      int sizeCopy = size;
      String[] keyListCopy = keyList.clone();
      int[] errorNumberCopy = errorNumber.clone();
      HashMap<String, Integer>[] errorListCopy = errorList.clone();
      int[] sourceNumberListCopy = sourceNumberList.clone();
      T1[] advancedValueSumListCopy = advancedValueSumList.clone();
      T1[] advancedValueMaxListCopy = advancedValueMaxList.clone();
      T1[] advancedValueMinListCopy = advancedValueMinList.clone();
      T1[] advancedValueSumOfSquaresListCopy = advancedValueSumOfSquaresList
          .clone();
      T2[] advancedValueSumOfLogsListCopy = advancedValueSumOfLogsList.clone();
      long[] advancedValueNListCopy = advancedValueNList.clone();
      keyList = new String[keys.size()];
      errorNumber = new int[keys.size()];
      errorList = new HashMap[keys.size()];
      sourceNumberList = new int[keys.size()];
      advancedValueSumList = operations.createVector1(keys.size());
      advancedValueMaxList = operations.createVector1(keys.size());
      advancedValueMinList = operations.createVector1(keys.size());
      advancedValueSumOfSquaresList = operations.createVector1(keys.size());
      advancedValueSumOfLogsList = operations.createVector2(keys.size());
      advancedValueNList = new long[keys.size()];
      size = 0;
      for (int i = 0; i < sizeCopy; i++) {
        if (keys.contains(keyListCopy[i])) {
          keyList[size] = keyListCopy[i];
          errorNumber[size] = errorNumberCopy[i];
          errorList[size] = errorListCopy[i];
          sourceNumberList[size] = sourceNumberListCopy[i];
          advancedValueSumList[size] = advancedValueSumListCopy[i];
          advancedValueMaxList[size] = advancedValueMaxListCopy[i];
          advancedValueMinList[size] = advancedValueMinListCopy[i];
          advancedValueSumOfSquaresList[size] = advancedValueSumOfSquaresListCopy[i];
          advancedValueSumOfLogsList[size] = advancedValueSumOfLogsListCopy[i];
          advancedValueNList[size] = advancedValueNListCopy[i];
          size++;
        }
      }
    }
  }
1004371
function translate(cldr, locale, opts) {
  if (typeof cldr === 'string') return augment(interpolate(cldr, opts));

  opts = opts || {};

  var pluralize = lookup(locale, cldr._format || opts.pluralFormat, plural);
  if (Array.isArray(cldr)) cldr = convertArray(cldr, pluralize, opts);

  validate(cldr, pluralize);

  var paramsObj = {};
  var cases = toFunctions(cldr, pluralize, opts, paramsObj);
  var paramsKeys = Object.keys(paramsObj);

  var key = cldr._plural_key ||
            opts.pluralKey ||
            discoverKey(paramsKeys,
                        opts.discoverableKeys || {'smart_count':1, 'count':1, 'length':1, 'items':1, 'total':1},
                        opts.defaultPluralKey || 'smart_count');

  var validatePluralKey = opts.validatePluralKey !== false;
  var silentValidation = !!opts.validatePluralSilent;
  var decimal = number.decimal[locale] || number.decimal.en;
  var toLocaleString = opts.toLocaleString !== false;

  return augment(function(params) {
    if (typeof params === 'number') params = convertSmartCount(params, key);

    var count = parseInt(params[key], 10);
    if (validatePluralKey && isNaN(count)) {
      if (silentValidation) return [];
      throw new Error('expected "' + key + '" to be a number. got "' + (typeof params[key]) + '".');
    }

    if (toLocaleString) params = formatNumbers(params, decimal);

    return (cases[count] || cases[pluralize(count || 0)])(params);
  }, paramsKeys);
}
1301431
function mapProps(fns, obj) {
  if(!(isObject(fns) && isObject(obj))) {
    throw new TypeError('mapProps: Objects required for both arguments')
  }

  return Object.keys(obj)
    .reduce(applyMap(fns, obj), {})
}
520660
def reduceByKey(self, func, numPartitions=None):
        
        return self.transform(lambda rdd: rdd.reduceByKey(func))
527530
function( elems, callback, arg ) {
		var length, value,
			i = 0,
			ret = [];

		// Go through the array, translating each of the items to their new values
		if ( isArrayLike( elems ) ) {
			length = elems.length;
			for ( ; i < length; i++ ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}

		// Go through every key on the object,
		} else {
			for ( i in elems ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}
		}

		// Flatten any nested arrays
		return concat.apply( [], ret );
	}
904823
function replaceParams(ast, keys) {
  Object.keys(ast)
    .filter(key => {
      const value = ast[key]
      return Array.isArray(value) || (typeof value === 'object' && value !== null)
    })
    .forEach(key => {
      const expr = ast[key]

      if (!(typeof expr === 'object' && expr.type === 'param')) return replaceParams(expr, keys)

      if (typeof keys[expr.value] === 'undefined') throw new Error(`no value for parameter :${expr.value} found`)
      ast[key] = createValueExpr(keys[expr.value])
      return null
    })

  return ast
}
1371403
function(collection, fn) {
        if ( Array.isArray(collection) ) {
          var result = [];

          for (var i = 0; i < collection.length; i++) {
            result[i] = fn(collection[i], i, collection);
          }

          return result;
        }
        else if ( Object.prototype.toString.call(collection) === '[object Object]' ) {
          var result = {};

          for (var key in collection) {
            if ( collection.hasOwnProperty(key) ) {
              result[key] = fn(collection[key]);
            }
          }

          return result;
        }
        else throw new TypeError('Invalid type. First argument must be an array or an object.');
      }
29656
function splitKeys (keys) {
		if (typeof(keys) === 'string') {
			return keys.replace(/^\s*\.\s*/,'')
				.replace(/(?:\s*\.\s*)+/g, '.')
				.split('.');
		}
		else if (Array.isArray(keys)) {
			return [].concat(keys);
		}
		return;
	}
595737
function(fn) {
      var keys = Object.keys(self);
      for(var i = keys.length - 1; i >= 0; i--) {
        var key = keys[i];
        if(!UT.Collection.isReservedKey(key)) {
          fn(key, self[key]);
        }
      }
    }
567248
function (keys) {
    var Parent = this.constructor;
    var opts = lazy.clone(this.options);
    var res = new Parent(opts);

    lazy.omit(this, keys, function (val, key) {
      res[key] = lazy.clone(val);
    });
    return res;
  }
975342
function normalizeFns(fns) {
  Object.keys(fns).forEach(function(key) {
    var handler = fns[key];
    if (typeof handler === 'function') {
      fns[key] = {
        enter: handler,
        leave: noop
      };
    }
  });
}
747490
@SuppressWarnings("unchecked")
  public void reduceToKeys(Set<String> keys) {
    if (size > 0) {
      int sizeCopy = size;
      String[] keyListCopy = keyList.clone();
      int[] errorNumberCopy = errorNumber.clone();
      HashMap<String, Integer>[] errorListCopy = errorList.clone();
      int[] sourceNumberListCopy = sourceNumberList.clone();
      T1[][] fullValueListCopy = fullValueList.clone();
      for (int i = 0; i < fullValueListCopy.length; i++) {
        if (fullValueListCopy[i] != null) {
          fullValueListCopy[i] = fullValueListCopy[i].clone();
        }
      }
      keyList = new String[keys.size()];
      errorNumber = new int[keys.size()];
      errorList = new HashMap[keys.size()];
      sourceNumberList = new int[keys.size()];
      fullValueList = operations.createMatrix1(keys.size());
      size = 0;
      for (int i = 0; i < sizeCopy; i++) {
        if (keys.contains(keyListCopy[i])) {
          keyList[size] = keyListCopy[i];
          errorNumber[size] = errorNumberCopy[i];
          errorList[size] = errorListCopy[i];
          sourceNumberList[size] = sourceNumberListCopy[i];
          fullValueList[size] = fullValueListCopy[i];
          size++;
        }
      }
    }
  }