Fix jshint
Split boolean expressions after the operator and don't create functions inside of loops.
Showing
2 changed files
with
13 additions
and
11 deletions
... | @@ -4,19 +4,21 @@ | ... | @@ -4,19 +4,21 @@ |
4 | var | 4 | var |
5 | bytes = Array.prototype.slice.call(data), | 5 | bytes = Array.prototype.slice.call(data), |
6 | step = 16, | 6 | step = 16, |
7 | hex, | 7 | formatHexString = function(e) { |
8 | ascii; | ||
9 | for (var j = 0; j < bytes.length / step; j++) { | ||
10 | hex = bytes.slice(j * step, j * step + step).map(function(e) { | ||
11 | var value = e.toString(16); | 8 | var value = e.toString(16); |
12 | return "00".substring(0, 2 - value.length) + value; | 9 | return "00".substring(0, 2 - value.length) + value; |
13 | }).join(' '); | 10 | }, |
14 | ascii = bytes.slice(j * step, j * step + step).map(function(e) { | 11 | formatAsciiString = function(e) { |
15 | if (e > 32 && e < 125) { | 12 | if (e > 32 && e < 125) { |
16 | return String.fromCharCode(e); | 13 | return String.fromCharCode(e); |
17 | } | 14 | } |
18 | return '.'; | 15 | return '.'; |
19 | }).join(''); | 16 | }, |
17 | hex, | ||
18 | ascii; | ||
19 | for (var j = 0; j < bytes.length / step; j++) { | ||
20 | hex = bytes.slice(j * step, j * step + step).map(formatHexString).join(' '); | ||
21 | ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join(''); | ||
20 | return hex + ' ' + ascii; | 22 | return hex + ' ' + ascii; |
21 | } | 23 | } |
22 | }, | 24 | }, | ... | ... |
... | @@ -391,10 +391,10 @@ | ... | @@ -391,10 +391,10 @@ |
391 | return this.writeBytes(data, offset + 2, length - 2); | 391 | return this.writeBytes(data, offset + 2, length - 2); |
392 | } | 392 | } |
393 | 393 | ||
394 | if (2 < length | 394 | if (2 < length && |
395 | && 0 === data[offset] | 395 | 0 === data[offset] && |
396 | && 0 === data[offset + 1] | 396 | 0 === data[offset + 1] && |
397 | && 1 === data[offset + 2]) { | 397 | 1 === data[offset + 2]) { |
398 | // 00 | 00 00 01 | 398 | // 00 | 00 00 01 |
399 | h264Frame.length -= 1; | 399 | h264Frame.length -= 1; |
400 | state = 3; | 400 | state = 3; | ... | ... |
-
Please register or sign in to post a comment