Use blocked scoped variables

In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
Tim Schaub
2018-01-11 23:32:36 -07:00
parent 0bf2b04dee
commit ad62739a6e
684 changed files with 18120 additions and 18184 deletions

View File

@@ -17,7 +17,7 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.XML}
* @api
*/
var _ol_format_WMTSCapabilities_ = function() {
const _ol_format_WMTSCapabilities_ = function() {
XML.call(this);
/**
@@ -45,7 +45,7 @@ _ol_format_WMTSCapabilities_.prototype.read;
* @inheritDoc
*/
_ol_format_WMTSCapabilities_.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
}
@@ -58,14 +58,14 @@ _ol_format_WMTSCapabilities_.prototype.readFromDocument = function(doc) {
* @inheritDoc
*/
_ol_format_WMTSCapabilities_.prototype.readFromNode = function(node) {
var version = node.getAttribute('version').trim();
var WMTSCapabilityObject = this.owsParser_.readFromNode(node);
const version = node.getAttribute('version').trim();
let WMTSCapabilityObject = this.owsParser_.readFromNode(node);
if (!WMTSCapabilityObject) {
return null;
}
WMTSCapabilityObject['version'] = version;
WMTSCapabilityObject = _ol_xml_.pushParseAndPop(WMTSCapabilityObject,
_ol_format_WMTSCapabilities_.PARSERS_, node, []);
_ol_format_WMTSCapabilities_.PARSERS_, node, []);
return WMTSCapabilityObject ? WMTSCapabilityObject : null;
};
@@ -78,7 +78,7 @@ _ol_format_WMTSCapabilities_.prototype.readFromNode = function(node) {
*/
_ol_format_WMTSCapabilities_.readContents_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.CONTENTS_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.CONTENTS_PARSERS_, node, objectStack);
};
@@ -90,7 +90,7 @@ _ol_format_WMTSCapabilities_.readContents_ = function(node, objectStack) {
*/
_ol_format_WMTSCapabilities_.readLayer_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.LAYER_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.LAYER_PARSERS_, node, objectStack);
};
@@ -102,7 +102,7 @@ _ol_format_WMTSCapabilities_.readLayer_ = function(node, objectStack) {
*/
_ol_format_WMTSCapabilities_.readTileMatrixSet_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.TMS_PARSERS_, node, objectStack);
};
@@ -113,12 +113,12 @@ _ol_format_WMTSCapabilities_.readTileMatrixSet_ = function(node, objectStack) {
* @return {Object|undefined} Style object.
*/
_ol_format_WMTSCapabilities_.readStyle_ = function(node, objectStack) {
var style = _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.STYLE_PARSERS_, node, objectStack);
const style = _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.STYLE_PARSERS_, node, objectStack);
if (!style) {
return undefined;
}
var isDefault = node.getAttribute('isDefault') === 'true';
const isDefault = node.getAttribute('isDefault') === 'true';
style['isDefault'] = isDefault;
return style;
@@ -132,9 +132,9 @@ _ol_format_WMTSCapabilities_.readStyle_ = function(node, objectStack) {
* @return {Object|undefined} Tile Matrix Set Link object.
*/
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_ = function(node,
objectStack) {
objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_, node, objectStack);
};
@@ -146,7 +146,7 @@ _ol_format_WMTSCapabilities_.readTileMatrixSetLink_ = function(node,
*/
_ol_format_WMTSCapabilities_.readDimensions_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.DIMENSION_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.DIMENSION_PARSERS_, node, objectStack);
};
@@ -157,10 +157,10 @@ _ol_format_WMTSCapabilities_.readDimensions_ = function(node, objectStack) {
* @return {Object|undefined} Resource URL object.
*/
_ol_format_WMTSCapabilities_.readResourceUrl_ = function(node, objectStack) {
var format = node.getAttribute('format');
var template = node.getAttribute('template');
var resourceType = node.getAttribute('resourceType');
var resource = {};
const format = node.getAttribute('format');
const template = node.getAttribute('template');
const resourceType = node.getAttribute('resourceType');
const resource = {};
if (format) {
resource['format'] = format;
}
@@ -181,8 +181,8 @@ _ol_format_WMTSCapabilities_.readResourceUrl_ = function(node, objectStack) {
* @return {Object|undefined} WGS84 BBox object.
*/
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_ = function(node, objectStack) {
var coordinates = _ol_xml_.pushParseAndPop([],
_ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_, node, objectStack);
const coordinates = _ol_xml_.pushParseAndPop([],
_ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_, node, objectStack);
if (coordinates.length != 2) {
return undefined;
}
@@ -197,7 +197,7 @@ _ol_format_WMTSCapabilities_.readWgs84BoundingBox_ = function(node, objectStack)
* @return {Object|undefined} Legend object.
*/
_ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) {
var legend = {};
const legend = {};
legend['format'] = node.getAttribute('format');
legend['href'] = XLink.readHref(node);
return legend;
@@ -211,12 +211,12 @@ _ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) {
* @return {Object|undefined} Coordinates object.
*/
_ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) {
var coordinates = XSD.readString(node).split(' ');
const coordinates = XSD.readString(node).split(' ');
if (!coordinates || coordinates.length != 2) {
return undefined;
}
var x = +coordinates[0];
var y = +coordinates[1];
const x = +coordinates[0];
const y = +coordinates[1];
if (isNaN(x) || isNaN(y)) {
return undefined;
}
@@ -232,7 +232,7 @@ _ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) {
*/
_ol_format_WMTSCapabilities_.readTileMatrix_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TM_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.TM_PARSERS_, node, objectStack);
};
@@ -243,10 +243,10 @@ _ol_format_WMTSCapabilities_.readTileMatrix_ = function(node, objectStack) {
* @return {Object|undefined} TileMatrixSetLimits Object.
*/
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_ = function(node,
objectStack) {
objectStack) {
return _ol_xml_.pushParseAndPop([],
_ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_, node,
objectStack);
_ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_, node,
objectStack);
};
@@ -258,7 +258,7 @@ _ol_format_WMTSCapabilities_.readTileMatrixLimitsList_ = function(node,
*/
_ol_format_WMTSCapabilities_.readTileMatrixLimits_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_, node, objectStack);
_ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_, node, objectStack);
};
@@ -290,10 +290,10 @@ _ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_ = [
* @private
*/
_ol_format_WMTSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Contents': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readContents_)
});
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Contents': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readContents_)
});
/**
@@ -302,12 +302,12 @@ _ol_format_WMTSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Layer': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLayer_),
'TileMatrixSet': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSet_)
});
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Layer': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLayer_),
'TileMatrixSet': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSet_)
});
/**
@@ -316,27 +316,27 @@ _ol_format_WMTSCapabilities_.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readStyle_),
'Format': _ol_xml_.makeObjectPropertyPusher(
XSD.readString),
'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_),
'Dimension': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readDimensions_),
'ResourceURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readResourceUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_),
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readStyle_),
'Format': _ol_xml_.makeObjectPropertyPusher(
XSD.readString),
'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_),
'Dimension': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readDimensions_),
'ResourceURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readResourceUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_),
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
/**
@@ -345,15 +345,15 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'LegendURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLegendUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'LegendURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLegendUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
/**
@@ -362,12 +362,12 @@ _ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrixSet': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_)
});
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrixSet': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_)
});
/**
* @const
@@ -375,10 +375,10 @@ _ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrixLimits': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readTileMatrixLimits_)
});
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrixLimits': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readTileMatrixLimits_)
});
/**
@@ -387,18 +387,18 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS
* @private
*/
_ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrix': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'MinTileRow': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MaxTileRow': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MinTileCol': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MaxTileCol': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger)
});
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrix': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'MinTileRow': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MaxTileRow': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MinTileCol': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MaxTileCol': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger)
});
/**
@@ -407,15 +407,15 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Default': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Value': _ol_xml_.makeObjectPropertyPusher(
XSD.readString)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Default': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Value': _ol_xml_.makeObjectPropertyPusher(
XSD.readString)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
/**
@@ -424,12 +424,12 @@ _ol_format_WMTSCapabilities_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'LowerCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_),
'UpperCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_)
});
_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'LowerCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_),
'UpperCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_)
});
/**
@@ -438,17 +438,17 @@ _ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'TileMatrix': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrix_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'SupportedCRS': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'TileMatrix': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrix_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'SupportedCRS': _ol_xml_.makeObjectPropertySetter(
XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
/**
@@ -457,21 +457,21 @@ _ol_format_WMTSCapabilities_.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
* @private
*/
_ol_format_WMTSCapabilities_.TM_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TopLeftCorner': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readCoordinates_),
'ScaleDenominator': _ol_xml_.makeObjectPropertySetter(
XSD.readDecimal),
'TileWidth': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'TileHeight': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MatrixWidth': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MatrixHeight': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TopLeftCorner': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readCoordinates_),
'ScaleDenominator': _ol_xml_.makeObjectPropertySetter(
XSD.readDecimal),
'TileWidth': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'TileHeight': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MatrixWidth': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger),
'MatrixHeight': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString)
}));
export default _ol_format_WMTSCapabilities_;