Inline simple goog.isDef() checks

This commit is contained in:
Tim Schaub
2015-09-27 10:18:44 -06:00
parent cf5eadebaa
commit 7659e47e07
22 changed files with 59 additions and 59 deletions

View File

@@ -25,7 +25,7 @@ ol.ResolutionConstraint.createSnapToResolutions =
* @return {number|undefined} Resolution.
*/
function(resolution, delta, direction) {
if (goog.isDef(resolution)) {
if (resolution !== undefined) {
var z =
ol.array.linearFindNearest(resolutions, resolution, direction);
z = goog.math.clamp(z + delta, 0, resolutions.length - 1);
@@ -53,7 +53,7 @@ ol.ResolutionConstraint.createSnapToPower =
* @return {number|undefined} Resolution.
*/
function(resolution, delta, direction) {
if (goog.isDef(resolution)) {
if (resolution !== undefined) {
var offset;
if (direction > 0) {
offset = 0;
@@ -65,7 +65,7 @@ ol.ResolutionConstraint.createSnapToPower =
var oldLevel = Math.floor(
Math.log(maxResolution / resolution) / Math.log(power) + offset);
var newLevel = Math.max(oldLevel + delta, 0);
if (goog.isDef(opt_maxLevel)) {
if (opt_maxLevel !== undefined) {
newLevel = Math.min(newLevel, opt_maxLevel);
}
return maxResolution / Math.pow(power, newLevel);