59dfeeb9f238723337f80ff4eb2649ca67ebd4d2
[platform/framework/web/crosswalk-tizen.git] /
1 define(['../function/makeIterator_'], function (makeIterator) {
2
3     /**
4      * Returns the index of the first item that matches criteria
5      */
6     function findIndex(arr, iterator, thisObj){
7         iterator = makeIterator(iterator, thisObj);
8         if (arr == null) {
9             return -1;
10         }
11
12         var i = -1, len = arr.length;
13         while (++i < len) {
14             if (iterator(arr[i], i, arr)) {
15                 return i;
16             }
17         }
18
19         return -1;
20     }
21
22     return findIndex;
23 });