mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. Backport-PR-URL: https://github.com/nodejs/node/pull/11775 PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
1 parent
de63698066
commit
db61c952de
806 files changed
+5031
-4995
No files matched your search
@@ -4,9 +4,9 @@
|
||||
// result of the entire buffer.
|
||||
|
||||
require('../common');
|
||||
var assert = require('assert');
|
||||
var SD = require('string_decoder').StringDecoder;
|
||||
var encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2'];
|
||||
const assert = require('assert');
|
||||
const SD = require('string_decoder').StringDecoder;
|
||||
const encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2'];
|
||||
|
||||
const bufs = [ '☃💩', 'asdf' ].map((b) => Buffer.from(b));
|
||||
|
||||
@@ -30,21 +30,21 @@ function testBuf(encoding, buf) {
|
||||
console.error('# %s', encoding, buf);
|
||||
|
||||
// write one byte at a time.
|
||||
var s = new SD(encoding);
|
||||
var res1 = '';
|
||||
for (var i = 0; i < buf.length; i++) {
|
||||
let s = new SD(encoding);
|
||||
let res1 = '';
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
res1 += s.write(buf.slice(i, i + 1));
|
||||
}
|
||||
res1 += s.end();
|
||||
|
||||
// write the whole buffer at once.
|
||||
var res2 = '';
|
||||
let res2 = '';
|
||||
s = new SD(encoding);
|
||||
res2 += s.write(buf);
|
||||
res2 += s.end();
|
||||
|
||||
// .toString() on the buffer
|
||||
var res3 = buf.toString(encoding);
|
||||
const res3 = buf.toString(encoding);
|
||||
|
||||
console.log('expect=%j', res3);
|
||||
console.log('res1=%j', res1);
|
||||
|
||||
Reference in new issue
Block a user