Inline simple goog.isDef() calls

This commit is contained in:
Tim Schaub
2015-09-27 10:34:44 -06:00
parent a86c270f6a
commit e3951fa3c6
45 changed files with 172 additions and 170 deletions

View File

@@ -166,7 +166,7 @@ ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function(
* @return {?} Callback result.
*/
function(feature) {
goog.asserts.assert(goog.isDef(feature), 'passed a feature');
goog.asserts.assert(feature !== undefined, 'passed a feature');
var key = goog.getUid(feature).toString();
if (!(key in features)) {
features[key] = true;
@@ -290,7 +290,7 @@ ol.source.ImageVector.prototype.renderFeature_ =
* @api stable
*/
ol.source.ImageVector.prototype.setStyle = function(style) {
this.style_ = goog.isDef(style) ? style : ol.style.defaultStyleFunction;
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
this.styleFunction_ = goog.isNull(style) ?
undefined : ol.style.createStyleFunction(this.style_);
this.changed();

View File

@@ -173,7 +173,7 @@ ol.source.TileArcGISRest.prototype.getUrls = function() {
* @api stable
*/
ol.source.TileArcGISRest.prototype.setUrl = function(url) {
var urls = goog.isDef(url) ? ol.TileUrlFunction.expandUrl(url) : null;
var urls = url !== undefined ? ol.TileUrlFunction.expandUrl(url) : null;
this.setUrls(urls);
};

View File

@@ -48,7 +48,7 @@ goog.inherits(ol.DebugTile_, ol.Tile);
* @inheritDoc
*/
ol.DebugTile_.prototype.getImage = function(opt_context) {
var key = goog.isDef(opt_context) ? goog.getUid(opt_context) : -1;
var key = opt_context !== undefined ? goog.getUid(opt_context) : -1;
if (key in this.canvasByContext_) {
return this.canvasByContext_[key];
} else {

View File

@@ -99,8 +99,8 @@ ol.source.TileImage.prototype.getTile =
this.tileUrlFunction(urlTileCoord, pixelRatio, projection);
var tile = new this.tileClass(
tileCoord,
goog.isDef(tileUrl) ? ol.TileState.IDLE : ol.TileState.EMPTY,
goog.isDef(tileUrl) ? tileUrl : '',
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
tileUrl !== undefined ? tileUrl : '',
this.crossOrigin,
this.tileLoadFunction);
goog.events.listen(tile, goog.events.EventType.CHANGE,

View File

@@ -79,7 +79,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
if (goog.isDef(tileJSON.attribution) &&
goog.isNull(this.getAttributions())) {
var attributionExtent = goog.isDef(extent) ?
var attributionExtent = extent !== undefined ?
extent : epsg4326Projection.getExtent();
/** @type {Object.<string, Array.<ol.TileRange>>} */
var tileRanges = {};

View File

@@ -227,7 +227,7 @@ ol.source.Tile.prototype.getTilePixelSize =
*/
ol.source.Tile.prototype.getTileCoordForTileUrlFunction =
function(tileCoord, opt_projection) {
var projection = goog.isDef(opt_projection) ?
var projection = opt_projection !== undefined ?
opt_projection : this.getProjection();
var tileGrid = this.getTileGridForProjection(projection);
goog.asserts.assert(!goog.isNull(tileGrid), 'tile grid needed');

View File

@@ -139,7 +139,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
this.tileUrlFunction_ = ol.TileUrlFunction.createFromTemplates(grids);
if (tileJSON.attribution !== undefined) {
var attributionExtent = goog.isDef(extent) ?
var attributionExtent = extent !== undefined ?
extent : epsg4326Projection.getExtent();
/** @type {Object.<string, Array.<ol.TileRange>>} */
var tileRanges = {};
@@ -178,8 +178,8 @@ ol.source.TileUTFGrid.prototype.getTile =
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
var tile = new ol.source.TileUTFGridTile_(
tileCoord,
goog.isDef(tileUrl) ? ol.TileState.IDLE : ol.TileState.EMPTY,
goog.isDef(tileUrl) ? tileUrl : '',
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
tileUrl !== undefined ? tileUrl : '',
this.tileGrid.getTileCoordExtent(tileCoord),
this.preemptive_);
this.tileCache.set(tileCoordKey, tile);

View File

@@ -337,7 +337,7 @@ ol.source.TileWMS.prototype.resetCoordKeyPrefix_ = function() {
* @api stable
*/
ol.source.TileWMS.prototype.setUrl = function(url) {
var urls = goog.isDef(url) ? ol.TileUrlFunction.expandUrl(url) : null;
var urls = url !== undefined ? ol.TileUrlFunction.expandUrl(url) : null;
this.setUrls(urls);
};

View File

@@ -572,7 +572,7 @@ ol.source.Vector.prototype.getFeatures = function() {
features, goog.object.getValues(this.nullGeometryFeatures_));
}
}
goog.asserts.assert(goog.isDef(features),
goog.asserts.assert(features !== undefined,
'Neither featuresRtree_ nor featuresCollection_ are available');
return features;
};
@@ -692,7 +692,7 @@ ol.source.Vector.prototype.getExtent = function() {
*/
ol.source.Vector.prototype.getFeatureById = function(id) {
var feature = this.idIndex_[id.toString()];
return goog.isDef(feature) ? feature : null;
return feature !== undefined ? feature : null;
};

View File

@@ -410,7 +410,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
} else {
value = elt['values'][0];
}
goog.asserts.assert(goog.isDef(value), 'value could be found');
goog.asserts.assert(value !== undefined, 'value could be found');
dimensions[key] = value;
});
}
@@ -454,7 +454,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
/** @type {!Array.<string>} */
var urls = [];
var requestEncoding = config['requestEncoding'];
requestEncoding = goog.isDef(requestEncoding) ? requestEncoding : '';
requestEncoding = requestEncoding !== undefined ? requestEncoding : '';
goog.asserts.assert(
goog.array.contains(['REST', 'RESTful', 'KVP', ''], requestEncoding),

View File

@@ -165,7 +165,8 @@ goog.inherits(ol.source.ZoomifyTile_, ol.ImageTile);
*/
ol.source.ZoomifyTile_.prototype.getImage = function(opt_context) {
var tileSize = ol.DEFAULT_TILE_SIZE;
var key = goog.isDef(opt_context) ? goog.getUid(opt_context).toString() : '';
var key = opt_context !== undefined ?
goog.getUid(opt_context).toString() : '';
if (key in this.zoomifyImageByContext_) {
return this.zoomifyImageByContext_[key];
} else {