96e24987549602cf1a2fca544e520d04a4b5f6b4
[platform/framework/web/crosswalk-tizen.git] /
1 define(['../lang/isObject', '../object/values', '../array/map', '../function/makeIterator_'], function (isObject, values, arrMap, makeIterator) {
2
3     /**
4      * Map collection values, returns Array.
5      */
6     function map(list, callback, thisObj) {
7         callback = makeIterator(callback, thisObj);
8         // list.length to check array-like object, if not array-like
9         // we simply map all the object values
10         if( isObject(list) && list.length == null ){
11             list = values(list);
12         }
13         return arrMap(list, function (val, key, list) {
14             return callback(val, key, list);
15         });
16     }
17
18     return map;
19
20 });