Skip to content

Commit e1167b7

Browse files
curbenghtomap
authored andcommitted
style: no-var & prefer-const (#3745)
* style: no-var & prefer-const * refactor: Array.from() - https://stackoverflow.com/a/38213213 * style: object spacing * refactor: while() push
1 parent f7c7719 commit e1167b7

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

lib/extend/tag.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,10 @@ const placeholder = '\uFFFC';
4747
const rPlaceholder = /(?:<|&lt;)!--\uFFFC(\d+)--(?:>|&gt;)/g;
4848

4949
function getContextLineNums(min, max, center, amplitude) {
50-
var result = [];
51-
var lbound = Math.max(min, center - amplitude);
52-
var hbound = Math.min(max, center + amplitude);
53-
for (var i = lbound; i <= hbound; i++) {
54-
result.push(i);
55-
}
56-
50+
const result = [];
51+
let lbound = Math.max(min, center - amplitude);
52+
const hbound = Math.min(max, center + amplitude);
53+
while (lbound <= hbound) result.push(lbound++);
5754
return result;
5855
}
5956

test/scripts/hexo/multi_config_path.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ describe('config flag handling', () => {
167167
});
168168

169169
it('1 not found file warning absolute', () => {
170-
let notFile = '/tmp/not_a_file.json';
170+
const notFile = '/tmp/not_a_file.json';
171171

172172
mcp(base, notFile).should.eql(pathFn.join(base, '_config.yml'));
173173
hexo.log.reader[0].type.should.eql('warning');
@@ -256,8 +256,8 @@ describe('config flag handling', () => {
256256
});
257257

258258
it('write multiconfig to specified path', () => {
259-
let outputPath = osFn.tmpdir();
260-
let combinedPath = pathFn.join(outputPath, '_multiconfig.yml');
259+
const outputPath = osFn.tmpdir();
260+
const combinedPath = pathFn.join(outputPath, '_multiconfig.yml');
261261

262262
mcp(base, 'test1.yml', outputPath).should.not.eql(combinedPath);
263263
mcp(base, 'test1.yml,test2.yml', outputPath).should.eql(combinedPath);

0 commit comments

Comments
 (0)