Code coverage report for collection/map.js

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

All files » collection/ » map.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201         1     8 3   8 21       1      
define(['../lang/isObject', '../object/values', '../array/map'], function (isObject, values, arrMap) {
 
    /**
     * Map collection values, returns Array.
     */
    function map(list, callback, thisObj) {
        // list.length to check array-like object, if not array-like
        // we simply map all the object values
        if( isObject(list) && list.length == null ){
            list = values(list);
        }
        return arrMap(list, function (val, key, list) {
            return callback.call(thisObj, val, key, list);
        });
    }
 
    return map;
 
});