Inline goog.isDef() property checks

This commit is contained in:
Tim Schaub
2015-09-27 10:21:50 -06:00
parent 7659e47e07
commit b36d697585
27 changed files with 58 additions and 58 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ ol.source.ImageMapGuide = function(options) {
this.params_ = goog.isDef(options.params) ? options.params : {};
var imageUrlFunction;
if (goog.isDef(options.url)) {
if (options.url !== undefined) {
imageUrlFunction = ol.ImageUrlFunction.createFromParamsFunction(
options.url, this.params_, goog.bind(this.getUrl, this));
} else {
+1 -1
View File
@@ -27,7 +27,7 @@ ol.source.ImageStatic = function(options) {
var imageExtent = options.imageExtent;
var resolution, resolutions;
if (goog.isDef(options.imageSize)) {
if (options.imageSize !== undefined) {
resolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
resolutions = [resolution];
}
+1 -1
View File
@@ -261,7 +261,7 @@ ol.source.ImageVector.prototype.renderFeature_ =
var styles;
if (goog.isDef(feature.getStyleFunction())) {
styles = feature.getStyleFunction().call(feature, resolution);
} else if (goog.isDef(this.styleFunction_)) {
} else if (this.styleFunction_ !== undefined) {
styles = this.styleFunction_(feature, resolution);
}
if (!goog.isDefAndNotNull(styles)) {
+1 -1
View File
@@ -19,7 +19,7 @@ ol.source.OSM = function(opt_options) {
var options = opt_options || {};
var attributions;
if (goog.isDef(options.attributions)) {
if (options.attributions !== undefined) {
attributions = options.attributions;
} else {
attributions = [ol.source.OSM.ATTRIBUTION];
+1 -1
View File
@@ -133,7 +133,7 @@ ol.source.Raster = function(options) {
goog.base(this, {});
if (goog.isDef(options.operation)) {
if (options.operation !== undefined) {
this.setOperation(options.operation, options.lib);
}
+2 -2
View File
@@ -57,13 +57,13 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
var sourceProjection = this.getProjection();
var extent;
if (goog.isDef(tileJSON.bounds)) {
if (tileJSON.bounds !== undefined) {
var transform = ol.proj.getTransformFromProjections(
epsg4326Projection, sourceProjection);
extent = ol.extent.applyTransform(tileJSON.bounds, transform);
}
if (goog.isDef(tileJSON.scheme)) {
if (tileJSON.scheme !== undefined) {
goog.asserts.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
}
var minZoom = tileJSON.minzoom || 0;
+3 -3
View File
@@ -110,13 +110,13 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
var sourceProjection = this.getProjection();
var extent;
if (goog.isDef(tileJSON.bounds)) {
if (tileJSON.bounds !== undefined) {
var transform = ol.proj.getTransformFromProjections(
epsg4326Projection, sourceProjection);
extent = ol.extent.applyTransform(tileJSON.bounds, transform);
}
if (goog.isDef(tileJSON.scheme)) {
if (tileJSON.scheme !== undefined) {
goog.asserts.assert(tileJSON.scheme == 'xyz', 'tileJSON-scheme is "xyz"');
}
var minZoom = tileJSON.minzoom || 0;
@@ -138,7 +138,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
this.tileUrlFunction_ = ol.TileUrlFunction.createFromTemplates(grids);
if (goog.isDef(tileJSON.attribution)) {
if (tileJSON.attribution !== undefined) {
var attributionExtent = goog.isDef(extent) ?
extent : epsg4326Projection.getExtent();
/** @type {Object.<string, Array.<ol.TileRange>>} */
+3 -3
View File
@@ -67,11 +67,11 @@ ol.source.TileVector = function(options) {
*/
this.tiles_ = {};
if (goog.isDef(options.tileUrlFunction)) {
if (options.tileUrlFunction !== undefined) {
this.setTileUrlFunction(options.tileUrlFunction);
} else if (goog.isDef(options.urls)) {
} else if (options.urls !== undefined) {
this.setUrls(options.urls);
} else if (goog.isDef(options.url)) {
} else if (options.url !== undefined) {
this.setUrl(options.url);
}
+2 -2
View File
@@ -91,9 +91,9 @@ ol.source.Vector = function(opt_options) {
*/
this.loader_ = goog.nullFunction;
if (goog.isDef(options.loader)) {
if (options.loader !== undefined) {
this.loader_ = options.loader;
} else if (goog.isDef(options.url)) {
} else if (options.url !== undefined) {
goog.asserts.assert(goog.isDef(options.format),
'format must be set when url is set');
// create a XHR feature loader for "url" and "format"
+3 -3
View File
@@ -56,11 +56,11 @@ ol.source.XYZ = function(options) {
wrapX: goog.isDef(options.wrapX) ? options.wrapX : true
});
if (goog.isDef(options.tileUrlFunction)) {
if (options.tileUrlFunction !== undefined) {
this.setTileUrlFunction(options.tileUrlFunction);
} else if (goog.isDef(options.urls)) {
} else if (options.urls !== undefined) {
this.setUrls(options.urls);
} else if (goog.isDef(options.url)) {
} else if (options.url !== undefined) {
this.setUrl(options.url);
}