npmtest-mout (v0.0.1)

Code coverage report for node-npmtest-mout/node_modules/mout/array/some.js

Statements: 23.08% (3 / 13)      Branches: 0% (0 / 4)      Functions: 0% (0 / 1)      Lines: 23.08% (3 / 13)      Ignored: none     

All files » node-npmtest-mout/node_modules/mout/array/ » some.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 291         1                                       1      
var makeIterator = require('../function/makeIterator_');
 
    /**
     * Array some
     */
    function some(arr, callback, thisObj) {
        callback = makeIterator(callback, thisObj);
        var result = false;
        if (arr == null) {
            return result;
        }
 
        var i = -1, len = arr.length;
        while (++i < len) {
            // we iterate over sparse items since there is no way to make it
            // work properly on IE 7-8. see #64
            if ( callback(arr[i], i, arr) ) {
                result = true;
                break;
            }
        }
 
        return result;
    }
 
    module.exports = some;