Inline !goog.isDef() property checks

This commit is contained in:
Tim Schaub
2015-09-27 10:24:38 -06:00
parent 6638ae855d
commit 3a0683f373
8 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ ol.Image.prototype.handleImageError_ = function() {
* @private * @private
*/ */
ol.Image.prototype.handleImageLoad_ = function() { ol.Image.prototype.handleImageLoad_ = function() {
if (!goog.isDef(this.resolution)) { if (this.resolution === undefined) {
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height; this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
} }
this.state = ol.ImageState.LOADED; this.state = ol.ImageState.LOADED;
+1 -1
View File
@@ -152,7 +152,7 @@ ol.proj.Projection = function(options) {
if (goog.isDef(def.axis) && !goog.isDef(options.axisOrientation)) { if (goog.isDef(def.axis) && !goog.isDef(options.axisOrientation)) {
this.axisOrientation_ = def.axis; this.axisOrientation_ = def.axis;
} }
if (!goog.isDef(options.units)) { if (options.units === undefined) {
var units = def.units; var units = def.units;
if (units === undefined) { if (units === undefined) {
if (def.to_meter !== undefined) { if (def.to_meter !== undefined) {
+1 -1
View File
@@ -103,7 +103,7 @@ ol.source.Cluster.prototype.onSourceChange_ = function() {
* @private * @private
*/ */
ol.source.Cluster.prototype.cluster_ = function() { ol.source.Cluster.prototype.cluster_ = function() {
if (!goog.isDef(this.resolution_)) { if (this.resolution_ === undefined) {
return; return;
} }
this.features_.length = 0; this.features_.length = 0;
+2 -2
View File
@@ -142,7 +142,7 @@ ol.source.ImageWMS.prototype.getGetFeatureInfoUrl =
goog.asserts.assert(!('VERSION' in params), goog.asserts.assert(!('VERSION' in params),
'key VERSION is not allowed in params'); 'key VERSION is not allowed in params');
if (!goog.isDef(this.url_)) { if (this.url_ === undefined) {
return undefined; return undefined;
} }
@@ -188,7 +188,7 @@ ol.source.ImageWMS.prototype.getParams = function() {
ol.source.ImageWMS.prototype.getImage = ol.source.ImageWMS.prototype.getImage =
function(extent, resolution, pixelRatio, projection) { function(extent, resolution, pixelRatio, projection) {
if (!goog.isDef(this.url_)) { if (this.url_ === undefined) {
return null; return null;
} }
+1 -1
View File
@@ -58,7 +58,7 @@ ol.style.Fill.prototype.setColor = function(color) {
* @inheritDoc * @inheritDoc
*/ */
ol.style.Fill.prototype.getChecksum = function() { ol.style.Fill.prototype.getChecksum = function() {
if (!goog.isDef(this.checksum_)) { if (this.checksum_ === undefined) {
this.checksum_ = 'f' + (!goog.isNull(this.color_) ? this.checksum_ = 'f' + (!goog.isNull(this.color_) ?
ol.color.asString(this.color_) : '-'); ol.color.asString(this.color_) : '-');
} }
+1 -1
View File
@@ -203,7 +203,7 @@ ol.style.Stroke.prototype.setWidth = function(width) {
* @inheritDoc * @inheritDoc
*/ */
ol.style.Stroke.prototype.getChecksum = function() { ol.style.Stroke.prototype.getChecksum = function() {
if (!goog.isDef(this.checksum_)) { if (this.checksum_ === undefined) {
var raw = 's' + var raw = 's' +
(!goog.isNull(this.color_) ? (!goog.isNull(this.color_) ?
ol.color.asString(this.color_) : '-') + ',' + ol.color.asString(this.color_) : '-') + ',' +
+1 -1
View File
@@ -552,7 +552,7 @@ ol.tilegrid.createXYZ = function(opt_options) {
var options = /** @type {olx.tilegrid.TileGridOptions} */ ({}); var options = /** @type {olx.tilegrid.TileGridOptions} */ ({});
goog.object.extend(options, goog.isDef(opt_options) ? goog.object.extend(options, goog.isDef(opt_options) ?
opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({})); opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({}));
if (!goog.isDef(options.extent)) { if (options.extent === undefined) {
options.extent = ol.proj.get('EPSG:3857').getExtent(); options.extent = ol.proj.get('EPSG:3857').getExtent();
} }
options.resolutions = ol.tilegrid.resolutionsFromExtent( options.resolutions = ol.tilegrid.resolutionsFromExtent(
+1 -1
View File
@@ -837,7 +837,7 @@ describe('ol.extent', function() {
it('takes arbitrary function', function() { it('takes arbitrary function', function() {
var transformFn = function(input, output, opt_dimension) { var transformFn = function(input, output, opt_dimension) {
var dimension = goog.isDef(opt_dimension) ? opt_dimension : 2; var dimension = goog.isDef(opt_dimension) ? opt_dimension : 2;
if (!goog.isDef(output)) { if (output === undefined) {
output = new Array(input.length); output = new Array(input.length);
} }
var n = input.length; var n = input.length;