Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
597 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | /**
|
---|
| 2 | * A specialized version of `_.every` for arrays without support for
|
---|
| 3 | * iteratee shorthands.
|
---|
| 4 | *
|
---|
| 5 | * @private
|
---|
| 6 | * @param {Array} [array] The array to iterate over.
|
---|
| 7 | * @param {Function} predicate The function invoked per iteration.
|
---|
| 8 | * @returns {boolean} Returns `true` if all elements pass the predicate check,
|
---|
| 9 | * else `false`.
|
---|
| 10 | */
|
---|
| 11 | function arrayEvery(array, predicate) {
|
---|
| 12 | var index = -1,
|
---|
| 13 | length = array == null ? 0 : array.length;
|
---|
| 14 |
|
---|
| 15 | while (++index < length) {
|
---|
| 16 | if (!predicate(array[index], index, array)) {
|
---|
| 17 | return false;
|
---|
| 18 | }
|
---|
| 19 | }
|
---|
| 20 | return true;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | module.exports = arrayEvery;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.