|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
929 bytes
|
| Line | |
|---|
| 1 | var baseForRight = require('./_baseForRight'),
|
|---|
| 2 | castFunction = require('./_castFunction'),
|
|---|
| 3 | keysIn = require('./keysIn');
|
|---|
| 4 |
|
|---|
| 5 | /**
|
|---|
| 6 | * This method is like `_.forIn` except that it iterates over properties of
|
|---|
| 7 | * `object` in the opposite order.
|
|---|
| 8 | *
|
|---|
| 9 | * @static
|
|---|
| 10 | * @memberOf _
|
|---|
| 11 | * @since 2.0.0
|
|---|
| 12 | * @category Object
|
|---|
| 13 | * @param {Object} object The object to iterate over.
|
|---|
| 14 | * @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|---|
| 15 | * @returns {Object} Returns `object`.
|
|---|
| 16 | * @see _.forIn
|
|---|
| 17 | * @example
|
|---|
| 18 | *
|
|---|
| 19 | * function Foo() {
|
|---|
| 20 | * this.a = 1;
|
|---|
| 21 | * this.b = 2;
|
|---|
| 22 | * }
|
|---|
| 23 | *
|
|---|
| 24 | * Foo.prototype.c = 3;
|
|---|
| 25 | *
|
|---|
| 26 | * _.forInRight(new Foo, function(value, key) {
|
|---|
| 27 | * console.log(key);
|
|---|
| 28 | * });
|
|---|
| 29 | * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
|
|---|
| 30 | */
|
|---|
| 31 | function forInRight(object, iteratee) {
|
|---|
| 32 | return object == null
|
|---|
| 33 | ? object
|
|---|
| 34 | : baseForRight(object, castFunction(iteratee), keysIn);
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | module.exports = forInRight;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.