main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
592 bytes
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * A specialized version of `_.some` for arrays without support for iteratee
|
---|
| 3 | * 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 any element passes the predicate check,
|
---|
| 9 | * else `false`.
|
---|
| 10 | */
|
---|
| 11 | function arraySome(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 true;
|
---|
| 18 | }
|
---|
| 19 | }
|
---|
| 20 | return false;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | export default arraySome;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.