main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
927 bytes
|
Line | |
---|
1 | import baseForRight from './_baseForRight.js';
|
---|
2 | import castFunction from './_castFunction.js';
|
---|
3 | import keysIn from './keysIn.js';
|
---|
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 | export default forInRight;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.