}
}
+ function identity(d) {
+ return d;
+ }
+
+ function findFirstIndexInArray(ary, opt_func, opt_this) {
+ var func = opt_func || identity;
+ for (var i = 0; i < ary.length; i++) {
+ if (func.call(opt_this, ary[i], i))
+ return i;
+ }
+ return -1;
+ }
+
+ function findFirstInArray(ary, opt_func, opt_this) {
+ var i = findFirstIndexInArray(ary, opt_func, opt_func);
+ if (i === -1)
+ return undefined;
+ return ary[i];
+ }
+
return {
asArray: asArray,
concatenateArrays: concatenateArrays,
dictionaryKeys: dictionaryKeys,
dictionaryValues: dictionaryValues,
iterItems: iterItems,
- iterObjectFieldsRecursively: iterObjectFieldsRecursively
+ iterObjectFieldsRecursively: iterObjectFieldsRecursively,
+ findFirstIndexInArray: findFirstIndexInArray,
+ findFirstInArray: findFirstInArray
};
});