push
github
314 of 335 branches covered (93.73%)
596 of 609 relevant lines covered (97.87%)
122.68 hits per line
| 1 |
'use strict';
|
|
| 2 |
|
|
| 3 |
function arrayFind(arr, fn) { |
|
| 4 |
if (!Array.isArray(arr)) {
|
|
| 5 |
return;
|
× |
| 6 |
} |
|
| 7 |
|
|
| 8 |
var idx = 0; |
153✔ |
| 9 |
while (idx < arr.length) {
|
153✔ |
| 10 |
var result = fn(arr[idx]);
|
153✔ |
| 11 |
if (result) {
|
|
| 12 |
// TODO: This is wrong in Liftoff
|
|
| 13 |
return arr[idx];
|
153✔ |
| 14 |
} |
|
| 15 |
idx++; |
× |
| 16 |
} |
|
| 17 |
} |
|
| 18 |
|
|
| 19 |
module.exports = arrayFind; |
153✔ |