Remove goog.array.findIndex
This commit is contained in:
@@ -239,3 +239,28 @@ ol.array.stableSort = function(arr, compareFnc) {
|
||||
arr[i] = tmp[i].value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.array.ArrayLike} arr The first array to compare..
|
||||
* @param {Function} func Optional comparison function.
|
||||
* @param {THISVAL=} opt_thisArg Optional this argument for the function.
|
||||
* @template THISVAL
|
||||
* @return {number} Whether the two arrays are equal.
|
||||
*/
|
||||
ol.array.findIndex = function(arr, func, opt_thisArg) {
|
||||
if (typeof func !== 'function') {
|
||||
throw new TypeError('func must be a function');
|
||||
}
|
||||
var list = Object(arr);
|
||||
var length = list.length >>> 0;
|
||||
var value;
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
value = list[i];
|
||||
if (func.call(opt_thisArg, value, i, list)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.source.WMTS');
|
||||
goog.provide('ol.source.WMTSRequestEncoding');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.object');
|
||||
goog.require('goog.uri.utils');
|
||||
@@ -338,7 +337,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
var idx, matrixSet;
|
||||
if (l['TileMatrixSetLink'].length > 1) {
|
||||
if ('projection' in config) {
|
||||
idx = goog.array.findIndex(l['TileMatrixSetLink'],
|
||||
idx = ol.array.findIndex(l['TileMatrixSetLink'],
|
||||
function(elt, index, array) {
|
||||
var tileMatrixSet = ol.array.find(tileMatrixSets, function(el) {
|
||||
return el['Identifier'] == elt['TileMatrixSet'];
|
||||
@@ -348,7 +347,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
) == config['projection'];
|
||||
});
|
||||
} else {
|
||||
idx = goog.array.findIndex(l['TileMatrixSetLink'],
|
||||
idx = ol.array.findIndex(l['TileMatrixSetLink'],
|
||||
function(elt, index, array) {
|
||||
return elt['TileMatrixSet'] == config['matrixSet'];
|
||||
});
|
||||
@@ -368,7 +367,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
if ('format' in config) {
|
||||
format = config['format'];
|
||||
}
|
||||
idx = goog.array.findIndex(l['Style'], function(elt, index, array) {
|
||||
idx = ol.array.findIndex(l['Style'], function(elt, index, array) {
|
||||
if ('style' in config) {
|
||||
return elt['Title'] == config['style'];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user