Remove goog.array.remove

This commit is contained in:
Nicholas L
2016-01-17 16:35:26 +13:00
parent d1b6a17773
commit d743ada8fd
3 changed files with 19 additions and 4 deletions

View File

@@ -158,3 +158,18 @@ ol.array.extend = function(arr, data) {
arr[arr.length] = extension[i];
}
}
/**
* @param {Array<VALUE>} arr The array to modify.
* @param {VALUE} obj The element to remove.
* @template VALUE
* @return {boolean} If the element was removed.
*/
ol.array.remove = function(arr, obj) {
var i = arr.indexOf(obj);
if (i > -1) {
arr.splice(i, 1);
}
return i > -1;
}