Permalink
Browse files

Replaced non-strict equality operator (==) with strict equality opera…

…tor (===)
  • Loading branch information...
1 parent f4a6221 commit c1c535e253a1f6e3ae176e9a19fb4cfe110f3772 @zerodivisi0n committed Mar 22, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/WebSocketConnection.js
@@ -599,15 +599,15 @@ WebSocketConnection.prototype.fragmentAndSend = function(frame, cb) {
var sentFragments = 0;
var sentCallback = function (err) {
if (err) {
- if (typeof cb == 'function') {
+ if (typeof cb === 'function') {
// pass only the first error
cb(err);
cb = null;
}
return;
}
++sentFragments;
- if ((typeof cb == 'function') && (sentFragments == numFragments)) {
+ if ((typeof cb === 'function') && (sentFragments === numFragments)) {
cb();
}
}
@@ -652,7 +652,7 @@ WebSocketConnection.prototype.sendCloseFrame = function(reasonCode, reasonText,
};
WebSocketConnection.prototype.sendFrame = function(frame, force, cb) {
- if (typeof force == 'function') {
+ if (typeof force === 'function') {
cb = force;
force = false;
}
@@ -674,15 +674,15 @@ WebSocketConnection.prototype.processOutgoingFrameQueue = function() {
// there is no need to accumulate messages in the queue if connection closed
// connection will not be restored and messages will never be sent
// therefore, notify callbacks about it
- if (!this.connected && (typeof cb == 'function')) {
+ if (!this.connected && (typeof cb === 'function')) {
cb("Connection closed");
return;
}
try {
var flushed = this.socket.write(buffer, cb);
}
catch(e) {
- if (typeof cb == 'function') {
+ if (typeof cb === 'function') {
cb(e.toString());
}
if (this.listeners('error').length > 0) {

0 comments on commit c1c535e

Please sign in to comment.