forInRight.js 840 B

12345678910111213141516171819202122232425262728293031
  1. var baseForRight = require('../internal/baseForRight'),
  2. createForIn = require('../internal/createForIn');
  3. /**
  4. * This method is like `_.forIn` except that it iterates over properties of
  5. * `object` in the opposite order.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @category Object
  10. * @param {Object} object The object to iterate over.
  11. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  12. * @param {*} [thisArg] The `this` binding of `iteratee`.
  13. * @returns {Object} Returns `object`.
  14. * @example
  15. *
  16. * function Foo() {
  17. * this.a = 1;
  18. * this.b = 2;
  19. * }
  20. *
  21. * Foo.prototype.c = 3;
  22. *
  23. * _.forInRight(new Foo, function(value, key) {
  24. * console.log(key);
  25. * });
  26. * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
  27. */
  28. var forInRight = createForIn(baseForRight);
  29. module.exports = forInRight;