Bläddra i källkod

[eslint] sort-vars

dev1
Lyubo Marinov 8 år sedan
förälder
incheckning
b5b0e95b4e

+ 1
- 0
.eslintrc.js Visa fil

@@ -158,6 +158,7 @@ module.exports = {
158 158
         'quote-props': 0,
159 159
         'semi': [ 'error', 'always' ],
160 160
         'semi-spacing': 2,
161
+        'sort-vars': 2,
161 162
         'space-before-blocks': 2,
162 163
         'space-before-function-paren': [ 'error', 'never' ],
163 164
         'space-in-parens': [ 'error', 'never' ],

+ 5
- 6
JitsiMeetJS.js Visa fil

@@ -98,7 +98,6 @@ var LibJitsiMeet = {
98 98
     mediaDevices: JitsiMediaDevices,
99 99
     analytics: null,
100 100
     init(options) {
101
-        let logObject, attr;
102 101
         Statistics.init(options);
103 102
 
104 103
         this.analytics = Statistics.analytics;
@@ -114,8 +113,8 @@ var LibJitsiMeet = {
114 113
         // Log deployment-specific information, if available.
115 114
         if (window.jitsiRegionInfo
116 115
             && Object.keys(window.jitsiRegionInfo).length > 0) {
117
-            logObject = {};
118
-            for (attr in window.jitsiRegionInfo) {
116
+            const logObject = {};
117
+            for (const attr in window.jitsiRegionInfo) {
119 118
                 if (window.jitsiRegionInfo.hasOwnProperty(attr)) {
120 119
                     logObject[attr] = window.jitsiRegionInfo[attr];
121 120
                 }
@@ -126,7 +125,7 @@ var LibJitsiMeet = {
126 125
         }
127 126
 
128 127
         if(this.version) {
129
-            logObject = {
128
+            const logObject = {
130 129
                 id: "component_version",
131 130
                 component: "lib-jitsi-meet",
132 131
                 version: this.version
@@ -272,8 +271,8 @@ var LibJitsiMeet = {
272 271
                 promiseFulfilled = true;
273 272
 
274 273
                 if(error.name === JitsiTrackErrors.UNSUPPORTED_RESOLUTION) {
275
-                    var oldResolution = options.resolution || '360',
276
-                        newResolution = getLowerResolution(oldResolution);
274
+                    const oldResolution = options.resolution || '360';
275
+                    const newResolution = getLowerResolution(oldResolution);
277 276
 
278 277
                     if (newResolution !== null) {
279 278
                         options.resolution = newResolution;

+ 4
- 4
modules/RTC/JitsiLocalTrack.js Visa fil

@@ -212,10 +212,10 @@ JitsiLocalTrack.prototype._fireNoDataFromSourceEvent = function() {
212 212
  *  enumerateDevices() call
213 213
  */
214 214
 JitsiLocalTrack.prototype._setRealDeviceIdFromDeviceList = function(devices) {
215
-    var track = this.getTrack(),
216
-        device = devices.find(function(d) {
217
-            return d.kind === track.kind + 'input' && d.label === track.label;
218
-        });
215
+    const track = this.getTrack();
216
+    const device
217
+        = devices.find(
218
+            d => d.kind === track.kind + 'input' && d.label === track.label);
219 219
 
220 220
     if (device) {
221 221
         this._realDeviceId = device.deviceId;

+ 10
- 15
modules/RTC/RTCUtils.js Visa fil

@@ -376,6 +376,7 @@ function pollForAvailableMediaDevices() {
376 376
 
377 377
 /**
378 378
  * Event handler for the 'devicechange' event.
379
+ *
379 380
  * @param {MediaDeviceInfo[]} devices - list of media devices.
380 381
  * @emits RTCEvents.DEVICE_LIST_CHANGED
381 382
  */
@@ -383,20 +384,14 @@ function onMediaDevicesListChanged(devicesReceived) {
383 384
     currentlyAvailableMediaDevices = devicesReceived.slice(0);
384 385
     logger.info('list of media devices has changed:', currentlyAvailableMediaDevices);
385 386
 
386
-    var videoInputDevices = currentlyAvailableMediaDevices.filter(function(d) {
387
-            return d.kind === 'videoinput';
388
-        }),
389
-        audioInputDevices = currentlyAvailableMediaDevices.filter(function(d) {
390
-            return d.kind === 'audioinput';
391
-        }),
392
-        videoInputDevicesWithEmptyLabels = videoInputDevices.filter(
393
-            function(d) {
394
-                return d.label === '';
395
-            }),
396
-        audioInputDevicesWithEmptyLabels = audioInputDevices.filter(
397
-            function(d) {
398
-                return d.label === '';
399
-            });
387
+    const videoInputDevices
388
+        = currentlyAvailableMediaDevices.filter(d => d.kind === 'videoinput');
389
+    const audioInputDevices
390
+        = currentlyAvailableMediaDevices.filter(d => d.kind === 'audioinput');
391
+    const videoInputDevicesWithEmptyLabels
392
+        = videoInputDevices.filter(d => d.label === '');
393
+    const audioInputDevicesWithEmptyLabels
394
+        = audioInputDevices.filter(d => d.label === '');
400 395
 
401 396
     if (videoInputDevices.length &&
402 397
         videoInputDevices.length === videoInputDevicesWithEmptyLabels.length) {
@@ -575,7 +570,7 @@ function obtainDevices(options) {
575 570
  * @returns {*[]} object that describes the new streams
576 571
  */
577 572
 function handleLocalStream(streams, resolution) {
578
-    var audioStream, videoStream, desktopStream, res = [];
573
+    var audioStream, desktopStream, res = [], videoStream;
579 574
 
580 575
     // XXX The function obtainAudioAndVideoPermissions has examined the type of
581 576
     // the browser, its capabilities, etc. and has taken the decision whether to

+ 7
- 14
modules/statistics/RTPStatsCollector.js Visa fil

@@ -337,9 +337,7 @@ StatsCollector.prototype._defineGetStatValueMethod = function(keys) {
337 337
         // example, if item has a stat property of type function, then it's very
338 338
         // likely that whoever defined it wanted you to call it in order to
339 339
         // retrieve the value associated with a specific key.
340
-        itemStatByKey = function(item, key) {
341
-            return item.stat(key); 
342
-        };
340
+        itemStatByKey = (item, key) => item.stat(key);
343 341
         break;
344 342
     case RTCBrowserType.RTC_BROWSER_REACT_NATIVE:
345 343
         // The implementation provided by react-native-webrtc follows the
@@ -359,9 +357,7 @@ StatsCollector.prototype._defineGetStatValueMethod = function(keys) {
359 357
         };
360 358
         break;
361 359
     default:
362
-        itemStatByKey = function(item, key) {
363
-            return item[key]; 
364
-        };
360
+        itemStatByKey = (item, key) => item[key];
365 361
     }
366 362
 
367 363
     // Compose the 2 functions defined above to get a function which retrieves
@@ -409,7 +405,7 @@ StatsCollector.prototype.processStatsReport = function() {
409 405
         } catch(e) {/* not supported*/}
410 406
 
411 407
         if(now.type == 'googCandidatePair') {
412
-            var ip, type, localip, active;
408
+            var active, ip, localip, type;
413 409
             try {
414 410
                 ip = getStatValue(now, 'remoteAddress');
415 411
                 type = getStatValue(now, "transportType");
@@ -421,13 +417,10 @@ StatsCollector.prototype.processStatsReport = function() {
421 417
             }
422 418
             // Save the address unless it has been saved already.
423 419
             var conferenceStatsTransport = this.conferenceStats.transport;
424
-            if(!conferenceStatsTransport.some(function(t) {
425
-                return (
426
-                        t.ip == ip && t.type == type && t.localip == localip
427
-                );
428
-            })) {
429
-                conferenceStatsTransport.push(
430
-                    {ip, type, localip});
420
+            if(!conferenceStatsTransport.some(
421
+                    t =>
422
+                        t.ip == ip && t.type == type && t.localip == localip)) {
423
+                conferenceStatsTransport.push({ip, type, localip});
431 424
             }
432 425
             continue;
433 426
         }

+ 5
- 5
modules/xmpp/SDP.js Visa fil

@@ -104,7 +104,7 @@ SDP.prototype.containsSSRC = function(ssrc) {
104 104
 
105 105
 // remove iSAC and CN from SDP
106 106
 SDP.prototype.mangle = function() {
107
-    var i, j, mline, lines, rtpmap, newdesc;
107
+    var i, j, lines, mline, newdesc, rtpmap;
108 108
     for (i = 0; i < this.media.length; i++) {
109 109
         lines = this.media[i].split('\r\n');
110 110
         lines.pop(); // remove empty last element
@@ -153,7 +153,7 @@ SDP.prototype.removeMediaLines = function(mediaindex, prefix) {
153 153
 
154 154
 // add content's to a jingle element
155 155
 SDP.prototype.toJingle = function(elem, thecreator) {
156
-    var i, j, k, mline, ssrc, rtpmap, tmp, lines;
156
+    var i, j, k, lines, mline, rtpmap, ssrc, tmp;
157 157
     // new bundle plan
158 158
     lines = SDPUtil.find_lines(this.session, 'a=group:');
159 159
     if (lines.length) {
@@ -356,7 +356,7 @@ SDP.prototype.toJingle = function(elem, thecreator) {
356 356
 };
357 357
 
358 358
 SDP.prototype.transportToJingle = function(mediaindex, elem) {
359
-    var tmp, sctpmap, sctpAttrs, fingerprints;
359
+    var fingerprints, sctpAttrs, sctpmap, tmp;
360 360
     var self = this;
361 361
     elem.c('transport');
362 362
 
@@ -495,8 +495,8 @@ SDP.prototype.fromJingle = function(jingle) {
495 495
 
496 496
 // translate a jingle content element into an an SDP media part
497 497
 SDP.prototype.jingle2media = function(content) {
498
-    var media = '',
499
-        desc = content.find('description'),
498
+    var desc = content.find('description'),
499
+        media = '',
500 500
         self = this,
501 501
         tmp;
502 502
     var sctp = content.find(

+ 16
- 14
modules/xmpp/SDPUtil.js Visa fil

@@ -11,7 +11,7 @@ var SDPUtil = {
11 11
     },
12 12
     iceparams(mediadesc, sessiondesc) {
13 13
         var data = null;
14
-        var ufrag, pwd;
14
+        var pwd, ufrag;
15 15
         if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
16 16
                 && (pwd = SDPUtil.find_line(mediadesc, 'a=ice-pwd:', sessiondesc))) {
17 17
             data = {
@@ -37,8 +37,8 @@ var SDPUtil = {
37 37
         return line.substring(6);
38 38
     },
39 39
     parse_mline(line) {
40
-        var parts = line.substring(2).split(' '),
41
-            data = {};
40
+        var data = {},
41
+            parts = line.substring(2).split(' ');
42 42
         data.media = parts.shift();
43 43
         data.port = parts.shift();
44 44
         data.proto = parts.shift();
@@ -52,8 +52,8 @@ var SDPUtil = {
52 52
         return 'm=' + mline.media + ' ' + mline.port + ' ' + mline.proto + ' ' + mline.fmt.join(' ');
53 53
     },
54 54
     parse_rtpmap(line) {
55
-        var parts = line.substring(9).split(' '),
56
-            data = {};
55
+        var data = {},
56
+            parts = line.substring(9).split(' ');
57 57
         data.id = parts.shift();
58 58
         parts = parts[0].split('/');
59 59
         data.name = parts.shift();
@@ -82,8 +82,8 @@ var SDPUtil = {
82 82
         return line;
83 83
     },
84 84
     parse_crypto(line) {
85
-        var parts = line.substring(9).split(' '),
86
-            data = {};
85
+        var data = {},
86
+            parts = line.substring(9).split(' ');
87 87
         data.tag = parts.shift();
88 88
         data['crypto-suite'] = parts.shift();
89 89
         data['key-params'] = parts.shift();
@@ -93,17 +93,19 @@ var SDPUtil = {
93 93
         return data;
94 94
     },
95 95
     parse_fingerprint(line) { // RFC 4572
96
-        var parts = line.substring(14).split(' '),
97
-            data = {};
96
+        var data = {},
97
+            parts = line.substring(14).split(' ');
98 98
         data.hash = parts.shift();
99 99
         data.fingerprint = parts.shift();
100 100
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
101 101
         return data;
102 102
     },
103 103
     parse_fmtp(line) {
104
-        var parts = line.split(' '),
105
-            i, key, value,
106
-            data = [];
104
+        var data = [],
105
+            i,
106
+            key,
107
+            parts = line.split(' '),
108
+            value;
107 109
         parts.shift();
108 110
         parts = parts.join(' ').split(';');
109 111
         for (i = 0; i < parts.length; i++) {
@@ -189,8 +191,8 @@ var SDPUtil = {
189 191
         // proprietary mapping of a=ssrc lines
190 192
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
191 193
         // and parse according to that
192
-        var lines = desc.split('\r\n'),
193
-            data = {};
194
+        var data = {},
195
+            lines = desc.split('\r\n');
194 196
         for (var i = 0; i < lines.length; i++) {
195 197
             if (lines[i].substring(0, 7) == 'a=ssrc:') {
196 198
                 var idx = lines[i].indexOf(' ');

Laddar…
Avbryt
Spara