Browse Source

[eslint] yoda

dev1
Lyubo Marinov 8 years ago
parent
commit
2323eaa5dd

+ 1
- 0
.eslintrc.js View File

@@ -128,6 +128,7 @@ module.exports = {
128 128
         'no-with': 2,
129 129
         'vars-on-top': 2,
130 130
         'wrap-iife': [ 'error', 'inside' ],
131
+        'yoda': 2,
131 132
 
132 133
         // Strict Mode group
133 134
         'strict': 2,

+ 6
- 6
modules/RTC/DataChannels.js View File

@@ -84,10 +84,10 @@ DataChannels.prototype.onDataChannel = function(event) {
84 84
                 dataChannel,
85 85
                 e);
86 86
         }
87
-        if (('undefined' !== typeof obj) && (null !== obj)) {
87
+        if ((typeof obj !== 'undefined') && (obj !== null)) {
88 88
             const colibriClass = obj.colibriClass;
89 89
 
90
-            if ('DominantSpeakerEndpointChangeEvent' === colibriClass) {
90
+            if (colibriClass === 'DominantSpeakerEndpointChangeEvent') {
91 91
                 // Endpoint ID from the Videobridge.
92 92
                 const dominantSpeakerEndpoint = obj.dominantSpeakerEndpoint;
93 93
 
@@ -96,7 +96,7 @@ DataChannels.prototype.onDataChannel = function(event) {
96 96
                     dominantSpeakerEndpoint);
97 97
                 self.eventEmitter.emit(RTCEvents.DOMINANT_SPEAKER_CHANGED,
98 98
                   dominantSpeakerEndpoint);
99
-            } else if ('InLastNChangeEvent' === colibriClass) {
99
+            } else if (colibriClass === 'InLastNChangeEvent') {
100 100
                 let oldValue = obj.oldValue;
101 101
                 let newValue = obj.newValue;
102 102
 
@@ -119,7 +119,7 @@ DataChannels.prototype.onDataChannel = function(event) {
119 119
                 }
120 120
 
121 121
                 self.eventEmitter.emit(RTCEvents.LASTN_CHANGED, oldValue, newValue);
122
-            } else if ('LastNEndpointsChangeEvent' === colibriClass) {
122
+            } else if (colibriClass === 'LastNEndpointsChangeEvent') {
123 123
                 // The new/latest list of last-n endpoint IDs.
124 124
                 const lastNEndpoints = obj.lastNEndpoints;
125 125
                 // The list of endpoint IDs which are entering the list of
@@ -132,11 +132,11 @@ DataChannels.prototype.onDataChannel = function(event) {
132 132
                     lastNEndpoints, endpointsEnteringLastN, obj);
133 133
                 self.eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED,
134 134
                     lastNEndpoints, endpointsEnteringLastN, obj);
135
-            } else if('EndpointMessage' === colibriClass) {
135
+            } else if(colibriClass === 'EndpointMessage') {
136 136
                 self.eventEmitter.emit(
137 137
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
138 138
                     obj.msgPayload);
139
-            } else if ('EndpointConnectivityStatusChangeEvent' === colibriClass) {
139
+            } else if (colibriClass === 'EndpointConnectivityStatusChangeEvent') {
140 140
                 const endpoint = obj.endpoint;
141 141
                 const isActive = obj.active === 'true';
142 142
 

+ 1
- 1
modules/RTC/JitsiLocalTrack.js View File

@@ -558,7 +558,7 @@ JitsiLocalTrack.prototype._setByteSent = function(bytesSent) {
558 558
     const iceConnectionState
559 559
         = this.conference ? this.conference.getConnectionState() : null;
560 560
 
561
-    if(this._testByteSent && 'connected' === iceConnectionState) {
561
+    if(this._testByteSent && iceConnectionState === 'connected') {
562 562
         setTimeout(() => {
563 563
             if(this._bytesSent <= 0) {
564 564
                 // we are not receiving anything from the microphone

+ 1
- 1
modules/xmpp/JingleSessionPC.js View File

@@ -1412,7 +1412,7 @@ export default class JingleSessionPC extends JingleSession {
1412 1412
             }
1413 1413
 
1414 1414
             error.source = null;
1415
-            if (request && 'function' == typeof request.tree) {
1415
+            if (request && typeof request.tree === 'function') {
1416 1416
                 error.source = request.tree();
1417 1417
             }
1418 1418
 

+ 2
- 2
modules/xmpp/moderator.js View File

@@ -161,7 +161,7 @@ Moderator.prototype.createConferenceIq = function() {
161 161
     elem.c(
162 162
         'property', {
163 163
             name: 'enableLipSync',
164
-            value: false !== this.options.connection.enableLipSync
164
+            value: this.options.connection.enableLipSync !== false
165 165
         }).up();
166 166
     if (this.options.conference.audioPacketDelay !== undefined) {
167 167
         elem.c(
@@ -390,7 +390,7 @@ Moderator.prototype._allocateConferenceFocusSuccess = function(
390 390
     // Reset the error timeout (because we haven't failed here).
391 391
     this.getNextErrorTimeout(true);
392 392
     // eslint-disable-next-line newline-per-chained-call
393
-    if ('true' === $(result).find('conference').attr('ready')) {
393
+    if ($(result).find('conference').attr('ready') === 'true') {
394 394
         // Reset the non-error timeout (because we've succeeded here).
395 395
         this.getNextTimeout(true);
396 396
         // Exec callback

+ 1
- 1
modules/xmpp/strophe.jingle.js View File

@@ -48,7 +48,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
48 48
         logger.log(`on jingle ${action} from ${fromJid}`, iq);
49 49
         let sess = this.sessions[sid];
50 50
 
51
-        if ('session-initiate' != action) {
51
+        if (action != 'session-initiate') {
52 52
             if (!sess) {
53 53
                 ack.attrs({ type: 'error' });
54 54
                 ack.c('error', {type: 'cancel'})

+ 1
- 1
modules/xmpp/xmpp.js View File

@@ -83,7 +83,7 @@ export default class XMPP extends Listenable {
83 83
         // this.caps.addFeature('urn:ietf:rfc:5576'); // a=ssrc
84 84
 
85 85
         // Enable Lipsync ?
86
-        if (RTCBrowserType.isChrome() && false !== this.options.enableLipSync) {
86
+        if (RTCBrowserType.isChrome() && this.options.enableLipSync !== false) {
87 87
             logger.info('Lip-sync enabled !');
88 88
             this.caps.addFeature('http://jitsi.org/meet/lipsync');
89 89
         }

Loading…
Cancel
Save