Code coverage report for array/find.js

Statements: 100% (11 / 11)      Branches: 100% (2 / 2)      Functions: 100% (3 / 3)      Lines: 100% (10 / 10)     

All files » array/ » find.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 231         1 14     14 32 32 14 14     14     1      
define(['./some'], function (some) {
 
    /**
     * Returns first item that matches criteria
     */
    function find(arr, iterator, thisObj){
        var needle,
            i = -1, n = arr.length,
            val;
        while (++i < n){
            val = arr[i];
            if (iterator.call(thisObj, val, i, arr)) {
                needle = val;
                break;
            }
        }
        return needle;
    }
 
    return find;
 
});