Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
648 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
---|
3 | *
|
---|
4 | * @private
|
---|
5 | * @param {boolean} [fromRight] Specify iterating from right to left.
|
---|
6 | * @returns {Function} Returns the new base function.
|
---|
7 | */
|
---|
8 | function createBaseFor(fromRight) {
|
---|
9 | return function(object, iteratee, keysFunc) {
|
---|
10 | var index = -1,
|
---|
11 | iterable = Object(object),
|
---|
12 | props = keysFunc(object),
|
---|
13 | length = props.length;
|
---|
14 |
|
---|
15 | while (length--) {
|
---|
16 | var key = props[fromRight ? length : ++index];
|
---|
17 | if (iteratee(iterable[key], key, iterable) === false) {
|
---|
18 | break;
|
---|
19 | }
|
---|
20 | }
|
---|
21 | return object;
|
---|
22 | };
|
---|
23 | }
|
---|
24 |
|
---|
25 | module.exports = createBaseFor;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.