Code coverage report for collection/make_.js

Statements: 100% (9 / 9)      Branches: 100% (4 / 4)      Functions: 100% (4 / 4)      Lines: 100% (8 / 8)     

All files » collection/ » make_.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201         1 13 86 86 2     84       1      
define(function(){
 
    /**
     * internal method used to create other collection modules.
     */
    function makeCollectionMethod(arrMethod, objMethod, defaultReturn) {
        return function(){
            var args = Array.prototype.slice.call(arguments);
            if (args[0] == null) {
                return defaultReturn;
            }
            // array-like is treated as array
            return (typeof args[0].length === 'number')? arrMethod.apply(null, args) : objMethod.apply(null, args);
        };
    }
 
    return makeCollectionMethod;
 
});