Remove goog.array.isSorted
This commit is contained in:
@@ -264,3 +264,16 @@ ol.array.findIndex = function(arr, func, opt_thisArg) {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ol.array.isSorted = function(arr, opt_func, opt_strict) {
|
||||||
|
var compare = opt_func || function(a, b) {
|
||||||
|
return a > b ? 1 : a < b ? -1 : 0;
|
||||||
|
};
|
||||||
|
return arr.every(function(currentVal, index) {
|
||||||
|
if (index === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var res = compare(arr[index - 1], currentVal);
|
||||||
|
return !(res > 0 || opt_strict && res === 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
goog.provide('ol.source.Image');
|
goog.provide('ol.source.Image');
|
||||||
goog.provide('ol.source.ImageEvent');
|
goog.provide('ol.source.ImageEvent');
|
||||||
|
|
||||||
goog.require('goog.array');
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.events.Event');
|
goog.require('goog.events.Event');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
@@ -52,7 +51,7 @@ ol.source.Image = function(options) {
|
|||||||
this.resolutions_ = options.resolutions !== undefined ?
|
this.resolutions_ = options.resolutions !== undefined ?
|
||||||
options.resolutions : null;
|
options.resolutions : null;
|
||||||
goog.asserts.assert(!this.resolutions_ ||
|
goog.asserts.assert(!this.resolutions_ ||
|
||||||
goog.array.isSorted(this.resolutions_,
|
ol.array.isSorted(this.resolutions_,
|
||||||
function(a, b) {
|
function(a, b) {
|
||||||
return b - a;
|
return b - a;
|
||||||
}, true), 'resolutions must be null or sorted in descending order');
|
}, true), 'resolutions must be null or sorted in descending order');
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
goog.provide('ol.tilegrid.TileGrid');
|
goog.provide('ol.tilegrid.TileGrid');
|
||||||
|
|
||||||
goog.require('goog.array');
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
@@ -42,7 +41,7 @@ ol.tilegrid.TileGrid = function(options) {
|
|||||||
* @type {!Array.<number>}
|
* @type {!Array.<number>}
|
||||||
*/
|
*/
|
||||||
this.resolutions_ = options.resolutions;
|
this.resolutions_ = options.resolutions;
|
||||||
goog.asserts.assert(goog.array.isSorted(this.resolutions_, function(a, b) {
|
goog.asserts.assert(ol.array.isSorted(this.resolutions_, function(a, b) {
|
||||||
return b - a;
|
return b - a;
|
||||||
}, true), 'resolutions must be sorted in descending order');
|
}, true), 'resolutions must be sorted in descending order');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user