Skip to content

Commit 7a79a68

Browse files
committed
Merge pull request #1230 from bobbywilson0/dev
Changed all typeof comparisons from == to ===
2 parents c0b752e + 42f53d6 commit 7a79a68

File tree

5 files changed

+46
-46
lines changed

5 files changed

+46
-46
lines changed

src/animation/Animation.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ Phaser.Animation.prototype = {
413413
this._parent.__tilePattern = false;
414414
this._parent.tilingTexture = false;
415415
}
416-
416+
417417
if (this.onUpdate)
418418
{
419419
this.onUpdate.dispatch(this, this.currentFrame);
@@ -547,7 +547,7 @@ Phaser.Animation.prototype = {
547547

548548
this.game.onPause.remove(this.onPause, this);
549549
this.game.onResume.remove(this.onResume, this);
550-
550+
551551
this.game = null;
552552
this._parent = null;
553553
this._frames = null;
@@ -745,7 +745,7 @@ Object.defineProperty(Phaser.Animation.prototype, 'enableUpdate', {
745745
*/
746746
Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zeroPad) {
747747

748-
if (typeof suffix == 'undefined') { suffix = ''; }
748+
if (typeof suffix === 'undefined') { suffix = ''; }
749749

750750
var output = [];
751751
var frame = '';
@@ -754,7 +754,7 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer
754754
{
755755
for (var i = start; i <= stop; i++)
756756
{
757-
if (typeof zeroPad == 'number')
757+
if (typeof zeroPad === 'number')
758758
{
759759
// str, len, pad, dir
760760
frame = Phaser.Utils.pad(i.toString(), zeroPad, '0', 1);
@@ -773,7 +773,7 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer
773773
{
774774
for (var i = start; i >= stop; i--)
775775
{
776-
if (typeof zeroPad == 'number')
776+
if (typeof zeroPad === 'number')
777777
{
778778
// str, len, pad, dir
779779
frame = Phaser.Utils.pad(i.toString(), zeroPad, '0', 1);

src/animation/AnimationManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Phaser.AnimationManager.prototype = {
237237
*/
238238
validateFrames: function (frames, useNumericIndex) {
239239

240-
if (typeof useNumericIndex == 'undefined') { useNumericIndex = true; }
240+
if (typeof useNumericIndex === 'undefined') { useNumericIndex = true; }
241241

242242
for (var i = 0; i < frames.length; i++)
243243
{
@@ -311,9 +311,9 @@ Phaser.AnimationManager.prototype = {
311311
*/
312312
stop: function (name, resetFrame) {
313313

314-
if (typeof resetFrame == 'undefined') { resetFrame = false; }
314+
if (typeof resetFrame === 'undefined') { resetFrame = false; }
315315

316-
if (typeof name == 'string')
316+
if (typeof name === 'string')
317317
{
318318
if (this._anims[name])
319319
{

src/input/InputHandler.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* The Input Handler is bound to a specific Sprite and is responsible for managing all Input events on that Sprite.
9-
*
9+
*
1010
* @class Phaser.InputHandler
1111
* @constructor
1212
* @param {Phaser.Sprite} sprite - The Sprite object to which this Input Handler belongs.
@@ -455,7 +455,7 @@ Phaser.InputHandler.prototype = {
455455
/**
456456
* The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
457457
* This value is only set when the pointer is over this Sprite.
458-
*
458+
*
459459
* @method Phaser.InputHandler#pointerX
460460
* @param {number} pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
461461
* @return {number} The x coordinate of the Input pointer.
@@ -471,7 +471,7 @@ Phaser.InputHandler.prototype = {
471471
/**
472472
* The y coordinate of the Input pointer, relative to the top-left of the parent Sprite
473473
* This value is only set when the pointer is over this Sprite.
474-
*
474+
*
475475
* @method Phaser.InputHandler#pointerY
476476
* @param {number} pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
477477
* @return {number} The y coordinate of the Input pointer.
@@ -486,7 +486,7 @@ Phaser.InputHandler.prototype = {
486486

487487
/**
488488
* If the Pointer is down this returns true. Please note that it only checks if the Pointer is down, not if it's down over any specific Sprite.
489-
*
489+
*
490490
* @method Phaser.InputHandler#pointerDown
491491
* @param {number} pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
492492
* @return {boolean} - True if the given pointer is down, otherwise false.
@@ -501,7 +501,7 @@ Phaser.InputHandler.prototype = {
501501

502502
/**
503503
* If the Pointer is up this returns true. Please note that it only checks if the Pointer is up, not if it's up over any specific Sprite.
504-
*
504+
*
505505
* @method Phaser.InputHandler#pointerUp
506506
* @param {number} pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
507507
* @return {boolean} - True if the given pointer is up, otherwise false.
@@ -516,7 +516,7 @@ Phaser.InputHandler.prototype = {
516516

517517
/**
518518
* A timestamp representing when the Pointer first touched the touchscreen.
519-
*
519+
*
520520
* @method Phaser.InputHandler#pointerTimeDown
521521
* @param {number} pointer - The index of the pointer to check. You can get this from Phaser.Pointer.id.
522522
* @return {number}
@@ -545,7 +545,7 @@ Phaser.InputHandler.prototype = {
545545

546546
/**
547547
* Is the Pointer over this Sprite?
548-
*
548+
*
549549
* @method Phaser.InputHandler#pointerOver
550550
* @param {number} [index] - The ID number of a Pointer to check. If you don't provide a number it will check all Pointers.
551551
* @return {boolean} - True if the given pointer (if a index was given, or any pointer if not) is over this object.
@@ -649,7 +649,7 @@ Phaser.InputHandler.prototype = {
649649
/**
650650
* Checks if the given pointer is both down and over the Sprite this InputHandler belongs to.
651651
* Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
652-
*
652+
*
653653
* @method Phaser.InputHandler#checkPointerDown
654654
* @param {Phaser.Pointer} pointer
655655
* @param {boolean} [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
@@ -684,7 +684,7 @@ Phaser.InputHandler.prototype = {
684684
/**
685685
* Checks if the given pointer is over the Sprite this InputHandler belongs to.
686686
* Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
687-
*
687+
*
688688
* @method Phaser.InputHandler#checkPointerOver
689689
* @param {Phaser.Pointer} pointer
690690
* @param {boolean} [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
@@ -915,7 +915,7 @@ Phaser.InputHandler.prototype = {
915915
this._pointerData[pointer.id].isDown = true;
916916
this._pointerData[pointer.id].isUp = false;
917917
this._pointerData[pointer.id].timeDown = this.game.time.now;
918-
918+
919919
if (this.sprite && this.sprite.events)
920920
{
921921
this.sprite.events.onInputDown.dispatch(this.sprite, pointer);
@@ -1192,12 +1192,12 @@ Phaser.InputHandler.prototype = {
11921192
*/
11931193
enableDrag: function (lockCenter, bringToTop, pixelPerfect, alphaThreshold, boundsRect, boundsSprite) {
11941194

1195-
if (typeof lockCenter == 'undefined') { lockCenter = false; }
1196-
if (typeof bringToTop == 'undefined') { bringToTop = false; }
1197-
if (typeof pixelPerfect == 'undefined') { pixelPerfect = false; }
1198-
if (typeof alphaThreshold == 'undefined') { alphaThreshold = 255; }
1199-
if (typeof boundsRect == 'undefined') { boundsRect = null; }
1200-
if (typeof boundsSprite == 'undefined') { boundsSprite = null; }
1195+
if (typeof lockCenter === 'undefined') { lockCenter = false; }
1196+
if (typeof bringToTop === 'undefined') { bringToTop = false; }
1197+
if (typeof pixelPerfect === 'undefined') { pixelPerfect = false; }
1198+
if (typeof alphaThreshold === 'undefined') { alphaThreshold = 255; }
1199+
if (typeof boundsRect === 'undefined') { boundsRect = null; }
1200+
if (typeof boundsSprite === 'undefined') { boundsSprite = null; }
12011201

12021202
this._dragPoint = new Phaser.Point();
12031203
this.draggable = true;
@@ -1272,7 +1272,7 @@ Phaser.InputHandler.prototype = {
12721272
this.sprite.x = this.globalToLocalX(pointer.x) + (this.sprite.x - bounds.centerX);
12731273
this.sprite.y = this.globalToLocalY(pointer.y) + (this.sprite.y - bounds.centerY);
12741274
}
1275-
1275+
12761276
this._dragPoint.setTo(this.sprite.x - this.globalToLocalX(pointer.x), this.sprite.y - this.globalToLocalY(pointer.y));
12771277
}
12781278

@@ -1365,8 +1365,8 @@ Phaser.InputHandler.prototype = {
13651365
*/
13661366
setDragLock: function (allowHorizontal, allowVertical) {
13671367

1368-
if (typeof allowHorizontal == 'undefined') { allowHorizontal = true; }
1369-
if (typeof allowVertical == 'undefined') { allowVertical = true; }
1368+
if (typeof allowHorizontal === 'undefined') { allowHorizontal = true; }
1369+
if (typeof allowVertical === 'undefined') { allowVertical = true; }
13701370

13711371
this.allowHorizontalDrag = allowHorizontal;
13721372
this.allowVerticalDrag = allowVertical;
@@ -1386,10 +1386,10 @@ Phaser.InputHandler.prototype = {
13861386
*/
13871387
enableSnap: function (snapX, snapY, onDrag, onRelease, snapOffsetX, snapOffsetY) {
13881388

1389-
if (typeof onDrag == 'undefined') { onDrag = true; }
1390-
if (typeof onRelease == 'undefined') { onRelease = false; }
1391-
if (typeof snapOffsetX == 'undefined') { snapOffsetX = 0; }
1392-
if (typeof snapOffsetY == 'undefined') { snapOffsetY = 0; }
1389+
if (typeof onDrag === 'undefined') { onDrag = true; }
1390+
if (typeof onRelease === 'undefined') { onRelease = false; }
1391+
if (typeof snapOffsetX === 'undefined') { snapOffsetX = 0; }
1392+
if (typeof snapOffsetY === 'undefined') { snapOffsetY = 0; }
13931393

13941394
this.snapX = snapX;
13951395
this.snapY = snapY;

src/sound/Sound.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
Phaser.Sound = function (game, key, volume, loop, connect) {
1818

19-
if (typeof volume == 'undefined') { volume = 1; }
20-
if (typeof loop == 'undefined') { loop = false; }
19+
if (typeof volume === 'undefined') { volume = 1; }
20+
if (typeof loop === 'undefined') { loop = false; }
2121
if (typeof connect === 'undefined') { connect = game.sound.connectToMaster; }
2222

2323
/**
@@ -306,7 +306,7 @@ Phaser.Sound = function (game, key, volume, loop, connect) {
306306
* @private
307307
*/
308308
this._paused = false;
309-
309+
310310
/**
311311
* @property {boolean} _onDecodedEventDispatched - Was the onDecoded event dispatched?
312312
* @private
@@ -345,8 +345,8 @@ Phaser.Sound.prototype = {
345345
*/
346346
addMarker: function (name, start, duration, volume, loop) {
347347

348-
if (typeof volume == 'undefined') { volume = 1; }
349-
if (typeof loop == 'undefined') { loop = false; }
348+
if (typeof volume === 'undefined') { volume = 1; }
349+
if (typeof loop === 'undefined') { loop = false; }
350350

351351
this.markers[name] = {
352352
name: name,
@@ -377,7 +377,7 @@ Phaser.Sound.prototype = {
377377
* @protected
378378
*/
379379
update: function () {
380-
380+
381381
if (this.isDecoded && !this._onDecodedEventDispatched)
382382
{
383383
this.onDecoded.dispatch(this);
@@ -642,7 +642,7 @@ Phaser.Sound.prototype = {
642642
}
643643

644644
return this;
645-
645+
646646
},
647647

648648
/**
@@ -659,7 +659,7 @@ Phaser.Sound.prototype = {
659659
marker = marker || '';
660660
position = position || 0;
661661
volume = volume || 1;
662-
if (typeof loop == 'undefined') { loop = false; }
662+
if (typeof loop === 'undefined') { loop = false; }
663663

664664
this.play(marker, position, volume, loop, true);
665665

@@ -789,7 +789,7 @@ Phaser.Sound.prototype = {
789789
/**
790790
* Starts this sound playing (or restarts it if already doing so) and sets the volume to zero.
791791
* Then increases the volume from 0 to 1 over the duration specified.
792-
* At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
792+
* At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
793793
* and the final volume (1) as the second parameter.
794794
*
795795
* @method Phaser.Sound#fadeIn
@@ -816,7 +816,7 @@ Phaser.Sound.prototype = {
816816

817817
/**
818818
* Decreases the volume of this Sound from its current value to 0 over the duration specified.
819-
* At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
819+
* At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
820820
* and the final volume (0) as the second parameter.
821821
*
822822
* @method Phaser.Sound#fadeOut

src/utils/Utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ Phaser.Utils = {
217217
*/
218218
pad: function (str, len, pad, dir) {
219219

220-
if (typeof(len) == "undefined") { var len = 0; }
221-
if (typeof(pad) == "undefined") { var pad = ' '; }
222-
if (typeof(dir) == "undefined") { var dir = 3; }
220+
if (typeof(len) === "undefined") { var len = 0; }
221+
if (typeof(pad) === "undefined") { var pad = ' '; }
222+
if (typeof(dir) === "undefined") { var dir = 3; }
223223

224224
var padlen = 0;
225225

@@ -415,7 +415,7 @@ Phaser.Utils = {
415415
/**
416416
* A polyfill for Function.prototype.bind
417417
*/
418-
if (typeof Function.prototype.bind != 'function') {
418+
if (typeof Function.prototype.bind !== 'function') {
419419

420420
/* jshint freeze: false */
421421
Function.prototype.bind = (function () {
@@ -426,7 +426,7 @@ if (typeof Function.prototype.bind != 'function') {
426426

427427
var target = this, boundArgs = slice.call(arguments, 1);
428428

429-
if (typeof target != 'function')
429+
if (typeof target !== 'function')
430430
{
431431
throw new TypeError();
432432
}

0 commit comments

Comments
 (0)