text: /**
   * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
   * Build: `lodash modularize modern exports="es6" -o ./modern/`
   * Copyright 2012-2014 The Dojo Foundation <http://dojofoundation.org/>
   * Based on Underscore.js 1.6.0 <http://underscorejs.org/LICENSE>
   * Copyright 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   * Available under MIT license <http://lodash.com/license>
   */
  import baseEachRight from '../internals/baseEachRight';
  import createCallback from '../functions/createCallback';
  
  /**
   * This method is like `_.reduce` except that it iterates over elements of a
   * collection from right to left.
   *
   * @static
   * @memberOf _
   * @alias foldr
   * @category Collections
   * @param {Array|Object|string} collection The collection to iterate over.
   * @param {Function} [callback=identity] The function called per iteration.
   * @param {*} [accumulator] Initial value of the accumulator.
   * @param {*} [thisArg] The `this` binding of `callback`.
   * @returns {*} Returns the accumulated value.
   * @example
   *
   * var array = [[0, 1], [2, 3], [4, 5]];
   * _.reduceRight(array, function(flattened, other) { return flattened.concat(other); }, []);
   * // => [4, 5, 2, 3, 0, 1]
   */
  function reduceRight(collection, callback, accumulator, thisArg) {
    var noaccum = arguments.length < 3;
    callback = createCallback(callback, thisArg, 4);
  
    baseEachRight(collection, function(value, index, collection) {
      accumulator = noaccum
        ? (noaccum = false, value)
        : callback(accumulator, value, index, collection);
    });
    return accumulator;
  }
  
  export default reduceRight;
  