Skip to content

Commit f3ea697

Browse files
committed
style: after lint
1 parent 4886532 commit f3ea697

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

lib/backup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ const cloneDeep = require('fclone')
1313
* @return {Object} backup Backup Locals
1414
*/
1515
function makeLocalsBackup (keys, locals) {
16-
let backup = {}
16+
const backup = {}
1717

1818
for (let i = 0; i < keys.length; i++) {
1919
const key = keys[i]
20-
if (locals.hasOwnProperty(key)) backup[key] = cloneDeep(locals[key])
20+
if (Object.prototype.hasOwnProperty.call(locals, key)) backup[key] = cloneDeep(locals[key])
2121
}
2222

2323
return backup
@@ -41,7 +41,7 @@ function revertBackupedLocals (keys, locals, backup) {
4141
delete locals[key]
4242

4343
// revert copied key value
44-
if (backup.hasOwnProperty(key)) locals[key] = backup[key]
44+
if (Object.prototype.hasOwnProperty.call(backup, key)) locals[key] = backup[key]
4545
}
4646

4747
return locals

lib/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const makeLocalsBackup = require('./backup').make
99
const revertBackupedLocals = require('./backup').revert
1010
const placeholders = require('./placeholders')
1111

12-
let delimitersSettings = []
12+
const delimitersSettings = []
1313
let conditionals, switches, loops, scopes, ignored
1414

1515
/**
@@ -177,8 +177,8 @@ function walk (opts, nodes) {
177177
// if we have a string, match and replace it
178178
if (typeof node === 'string') {
179179
// if node contains ignored expression delimiter, output as-is
180-
let before = delimitersSettings[1].text[0]
181-
let after = delimitersSettings[1].text[1]
180+
const before = delimitersSettings[1].text[0]
181+
const after = delimitersSettings[1].text[1]
182182
const ignoredDelimiter = new RegExp(`@${before}(.+?)${after}`, 'g')
183183

184184
if (ignoredDelimiter.test(node)) {
@@ -198,7 +198,7 @@ function walk (opts, nodes) {
198198

199199
// if not, we have an object, so we need to run the attributes and contents
200200
if (node.attrs) {
201-
for (let key in node.attrs) {
201+
for (const key in node.attrs) {
202202
node.attrs[key] = placeholders(node.attrs[key], ctx, delimitersSettings)
203203
}
204204
}
@@ -351,7 +351,7 @@ function walk (opts, nodes) {
351351
m.push(executeLoop(keys, target[index], index, opts.locals, treeString))
352352
}
353353
} else {
354-
for (let key in target) {
354+
for (const key in target) {
355355
opts.locals.loop = getLoopMeta(key, target)
356356
m.push(executeLoop(keys, target[key], key, opts.locals, treeString))
357357
}

lib/placeholders.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function placeholders (input, ctx, settings) {
5555

5656
if (/\W+/.test(expression)) {
5757
value = vm.runInContext(expression, ctx)
58-
} else if (ctx.hasOwnProperty(expression)) {
58+
} else if (Object.prototype.hasOwnProperty.call(ctx, expression)) {
5959
value = ctx[expression]
6060
}
6161

lib/tags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function getNextTag (nodes, i) {
2222
}
2323
}
2424

25-
return [ i, { tag: undefined } ]
25+
return [i, { tag: undefined }]
2626
}
2727

2828
/**

test/test-conditionals.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const expect = (file) => {
1515
}
1616

1717
function process (t, name, options, log = false) {
18-
return posthtml([ expressions(options) ])
18+
return posthtml([expressions(options)])
1919
.process(fixture(name))
2020
.then((result) => {
2121
log && console.log(result.html)
@@ -28,7 +28,7 @@ function process (t, name, options, log = false) {
2828
}
2929

3030
function error (name, cb) {
31-
return posthtml([ expressions() ])
31+
return posthtml([expressions()])
3232
.process(fixture(name))
3333
.catch(cb)
3434
}

test/test-core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const expect = (file) => {
1515
}
1616

1717
function process (t, name, options, log = false) {
18-
return posthtml([ expressions(options) ])
18+
return posthtml([expressions(options)])
1919
.process(fixture(name))
2020
.then((result) => {
2121
log && console.log(result.html)
@@ -28,7 +28,7 @@ function process (t, name, options, log = false) {
2828
}
2929

3030
function error (name, cb) {
31-
return posthtml([ expressions() ])
31+
return posthtml([expressions()])
3232
.process(fixture(name))
3333
.catch(cb)
3434
}

test/test-loops.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const expect = (file) => {
1515
}
1616

1717
function process (t, name, options, log = false) {
18-
return posthtml([ expressions(options) ])
18+
return posthtml([expressions(options)])
1919
.process(fixture(name))
2020
.then((result) => {
2121
log && console.log(result.html)
@@ -28,7 +28,7 @@ function process (t, name, options, log = false) {
2828
}
2929

3030
function error (name, cb) {
31-
return posthtml([ expressions() ])
31+
return posthtml([expressions()])
3232
.process(fixture(name))
3333
.catch(cb)
3434
}

test/test-scopes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const expect = (file) => {
1515
}
1616

1717
function process (t, name, options, log = false) {
18-
return posthtml([ expressions(options) ])
18+
return posthtml([expressions(options)])
1919
.process(fixture(name))
2020
.then((result) => {
2121
log && console.log(result.html)

test/test-switch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const expect = (file) => {
1515
}
1616

1717
function process (t, name, options, log = false) {
18-
return posthtml([ expressions(options) ])
18+
return posthtml([expressions(options)])
1919
.process(fixture(name))
2020
.then((result) => {
2121
log && console.log(result.html)
@@ -28,7 +28,7 @@ function process (t, name, options, log = false) {
2828
}
2929

3030
function error (name, cb) {
31-
return posthtml([ expressions() ])
31+
return posthtml([expressions()])
3232
.process(fixture(name))
3333
.catch(cb)
3434
}

0 commit comments

Comments
 (0)