Use Array.isArray instead of goog.isArray

This commit is contained in:
Frederic Junod
2016-02-08 14:04:29 +01:00
parent fb4992b580
commit 80e984a9c3
23 changed files with 39 additions and 39 deletions

View File

@@ -170,7 +170,7 @@ ol.format.EsriJSON.readPointGeometry_ = function(object) {
* @return {ol.geom.Geometry} LineString.
*/
ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
goog.asserts.assert(goog.isArray(object.paths),
goog.asserts.assert(Array.isArray(object.paths),
'object.paths should be an array');
goog.asserts.assert(object.paths.length === 1,
'object.paths array length should be 1');
@@ -185,7 +185,7 @@ ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
* @return {ol.geom.Geometry} MultiLineString.
*/
ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) {
goog.asserts.assert(goog.isArray(object.paths),
goog.asserts.assert(Array.isArray(object.paths),
'object.paths should be an array');
goog.asserts.assert(object.paths.length > 1,
'object.paths array length should be more than 1');

View File

@@ -203,7 +203,7 @@ ol.format.Feature.transformWithOptions = function(
return coordinates;
};
if (Array.isArray(transformed)) {
transform(/** @type {ol.Extent} */ (transformed));
transform(transformed);
} else {
transformed.applyTransform(transform);
}

View File

@@ -130,7 +130,7 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings),
goog.asserts.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
goog.asserts.assert(flatLinearRings.length > 0,
'flatLinearRings should have an array length larger than 0');
@@ -155,7 +155,7 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings),
goog.asserts.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
goog.asserts.assert(flatLinearRings.length > 0,
'flatLinearRings should have an array length larger than 0');

View File

@@ -247,7 +247,7 @@ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) {
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings),
goog.asserts.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
goog.asserts.assert(flatLinearRings.length > 0,
'flatLinearRings should have an array length of 1 or more');
@@ -272,7 +272,7 @@ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) {
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings),
goog.asserts.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
goog.asserts.assert(flatLinearRings.length > 0,
'flatLinearRings should have an array length of 1 or more');
@@ -1006,7 +1006,7 @@ ol.format.GML3.prototype.writeGeometryElement = function(node, geometry, objectS
var item = ol.object.assign({}, context);
item.node = node;
var value;
if (goog.isArray(geometry)) {
if (Array.isArray(geometry)) {
if (context.dataProjection) {
value = ol.proj.transformExtent(
geometry, context.featureProjection, context.dataProjection);
@@ -1233,7 +1233,7 @@ ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
goog.asserts.assert(ol.xml.isNode(parentNode),
'parentNode should be a node');
var nodeName;
if (!goog.isArray(value)) {
if (!Array.isArray(value)) {
goog.asserts.assertInstanceof(value, ol.geom.Geometry,
'value should be an ol.geom.Geometry');
nodeName = value.getType();

View File

@@ -163,7 +163,7 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
featureNS[defaultPrefix] = ns;
}
var parsersNS = {};
var featureTypes = goog.isArray(featureType) ? featureType : [featureType];
var featureTypes = Array.isArray(featureType) ? featureType : [featureType];
for (var p in featureNS) {
var parsers = {};
for (i = 0, ii = featureTypes.length; i < ii; ++i) {

View File

@@ -426,7 +426,7 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
* @private
*/
ol.format.KML.findStyle_ = function(styleValue, defaultStyle, sharedStyles) {
if (goog.isArray(styleValue)) {
if (Array.isArray(styleValue)) {
return styleValue;
} else if (typeof styleValue === 'string') {
// KML files in the wild occasionally forget the leading `#` on styleUrls
@@ -1267,7 +1267,7 @@ ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) {
var placemarkObject = objectStack[objectStack.length - 1];
goog.asserts.assert(goog.isObject(placemarkObject),
'placemarkObject should be an Object');
if (goog.isArray(styleMapValue)) {
if (Array.isArray(styleMapValue)) {
placemarkObject['Style'] = styleMapValue;
} else if (typeof styleMapValue === 'string') {
placemarkObject['styleUrl'] = styleMapValue;
@@ -1327,7 +1327,7 @@ ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) {
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings),
goog.asserts.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
goog.asserts.assert(flatLinearRings.length > 0,
'flatLinearRings array should not be empty');
@@ -1352,7 +1352,7 @@ ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) {
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings),
goog.asserts.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
goog.asserts.assert(flatLinearRings.length > 0,
'flatLinearRings array should not be empty');
@@ -2386,7 +2386,7 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
// resolution-independent here
var styles = styleFunction.call(feature, 0);
if (styles) {
var style = goog.isArray(styles) ? styles[0] : styles;
var style = Array.isArray(styles) ? styles[0] : styles;
if (this.writeStyles_) {
properties['Style'] = style;
}

View File

@@ -664,7 +664,7 @@ ol.format.WFS.prototype.writeGetFeature = function(options) {
bbox: options.bbox,
propertyNames: options.propertyNames ? options.propertyNames : []
};
goog.asserts.assert(goog.isArray(options.featureTypes),
goog.asserts.assert(Array.isArray(options.featureTypes),
'options.featureTypes should be an array');
ol.format.WFS.writeGetFeature_(node, options.featureTypes, [context]);
return node;