Replace goog.isDef(foo[bar]) with bar in foo

This commit is contained in:
Tim Schaub
2015-09-27 10:58:39 -06:00
parent b3b31ea16d
commit 27d1e808b8
3 changed files with 7 additions and 7 deletions

View File

@@ -295,7 +295,7 @@ ol.source.ImageWMS.prototype.getRequestUrl_ =
switch (this.serverType_) { switch (this.serverType_) {
case ol.source.wms.ServerType.GEOSERVER: case ol.source.wms.ServerType.GEOSERVER:
var dpi = (90 * pixelRatio + 0.5) | 0; var dpi = (90 * pixelRatio + 0.5) | 0;
if (goog.isDef(params['FORMAT_OPTIONS'])) { if ('FORMAT_OPTIONS' in params) {
params['FORMAT_OPTIONS'] += ';dpi:' + dpi; params['FORMAT_OPTIONS'] += ';dpi:' + dpi;
} else { } else {
params['FORMAT_OPTIONS'] = 'dpi:' + dpi; params['FORMAT_OPTIONS'] = 'dpi:' + dpi;

View File

@@ -240,7 +240,7 @@ ol.source.TileWMS.prototype.getRequestUrl_ =
switch (this.serverType_) { switch (this.serverType_) {
case ol.source.wms.ServerType.GEOSERVER: case ol.source.wms.ServerType.GEOSERVER:
var dpi = (90 * pixelRatio + 0.5) | 0; var dpi = (90 * pixelRatio + 0.5) | 0;
if (goog.isDef(params['FORMAT_OPTIONS'])) { if ('FORMAT_OPTIONS' in params) {
params['FORMAT_OPTIONS'] += ';dpi:' + dpi; params['FORMAT_OPTIONS'] += ';dpi:' + dpi;
} else { } else {
params['FORMAT_OPTIONS'] = 'dpi:' + dpi; params['FORMAT_OPTIONS'] = 'dpi:' + dpi;

View File

@@ -355,7 +355,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet']; var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];
var idx, matrixSet; var idx, matrixSet;
if (l['TileMatrixSetLink'].length > 1) { if (l['TileMatrixSetLink'].length > 1) {
if (goog.isDef(config['projection'])) { if ('projection' in config) {
idx = goog.array.findIndex(l['TileMatrixSetLink'], idx = goog.array.findIndex(l['TileMatrixSetLink'],
function(elt, index, array) { function(elt, index, array) {
var tileMatrixSet = goog.array.find(tileMatrixSets, function(el) { var tileMatrixSet = goog.array.find(tileMatrixSets, function(el) {
@@ -384,11 +384,11 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
'TileMatrixSet must not be null'); 'TileMatrixSet must not be null');
var format = /** @type {string} */ (l['Format'][0]); var format = /** @type {string} */ (l['Format'][0]);
if (goog.isDef(config['format'])) { if ('format' in config) {
format = config['format']; format = config['format'];
} }
idx = goog.array.findIndex(l['Style'], function(elt, index, array) { idx = goog.array.findIndex(l['Style'], function(elt, index, array) {
if (goog.isDef(config['style'])) { if ('style' in config) {
return elt['Title'] == config['style']; return elt['Title'] == config['style'];
} else { } else {
return elt['isDefault']; return elt['isDefault'];
@@ -400,7 +400,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var style = /** @type {string} */ (l['Style'][idx]['Identifier']); var style = /** @type {string} */ (l['Style'][idx]['Identifier']);
var dimensions = {}; var dimensions = {};
if (goog.isDef(l['Dimension'])) { if ('Dimension' in l) {
goog.array.forEach(l['Dimension'], function(elt, index, array) { goog.array.forEach(l['Dimension'], function(elt, index, array) {
var key = elt['Identifier']; var key = elt['Identifier'];
var value = elt['default']; var value = elt['default'];
@@ -423,7 +423,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
'found matrixSet in Contents/TileMatrixSet'); 'found matrixSet in Contents/TileMatrixSet');
var projection; var projection;
if (goog.isDef(config['projection'])) { if ('projection' in config) {
projection = ol.proj.get(config['projection']); projection = ol.proj.get(config['projection']);
} else { } else {
projection = ol.proj.get(matrixSetObj['SupportedCRS'].replace( projection = ol.proj.get(matrixSetObj['SupportedCRS'].replace(