8f60cda28517c312453e2eaf65d7d1f49c955506
[platform/framework/web/crosswalk-tizen.git] /
1 define(['./append', '../function/makeIterator_'], function (append, makeIterator) {
2
3     /**
4      * Maps the items in the array and concatenates the result arrays.
5      */
6     function collect(arr, callback, thisObj){
7         callback = makeIterator(callback, thisObj);
8         var results = [];
9         if (arr == null) {
10             return results;
11         }
12
13         var i = -1, len = arr.length;
14         while (++i < len) {
15             var value = callback(arr[i], i, arr);
16             if (value != null) {
17                 append(results, value);
18             }
19         }
20
21         return results;
22     }
23
24     return collect;
25
26 });