Skip to content

Commit 7b85ca3

Browse files
committed
style(index.js): after lint xo
1 parent c2a99dd commit 7b85ca3

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

lib/index.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'
1+
'use strict';
22

33
const fs = require('fs');
44
const path = require('path');
@@ -8,17 +8,15 @@ const {match} = require('posthtml/lib/api');
88
const expressions = require('posthtml-expressions');
99

1010
module.exports = (options = {}) => {
11-
options.root = options.root ?
12-
path.resolve(options.root) :
13-
process.cwd();
11+
options.root = options.root ? path.resolve(options.root) : process.cwd();
1412
options.encoding = options.encoding || 'utf-8';
1513

1614
return function posthtmlInclude(tree) {
1715
const cwd = options.cwd ?
1816
path.resolve(options.cwd) :
1917
(tree.options.from ?
2018
path.dirname(path.resolve(tree.options.from)) :
21-
process.cwd())
19+
process.cwd());
2220

2321
tree.parser = tree.parser || parser;
2422
tree.match = tree.match || match;
@@ -28,23 +26,29 @@ module.exports = (options = {}) => {
2826
let content;
2927
let subtree;
3028
let source;
31-
let posthtmlExpressionsOptions = options.posthtmlExpressionsOptions || {locals: false};
29+
let posthtmlExpressionsOptions = options.posthtmlExpressionsOptions || {
30+
locals: false
31+
};
3232
if (options.delimiters) {
3333
posthtmlExpressionsOptions.delimiters = options.delimiters;
3434
}
3535

3636
if (src) {
3737
src = path.isAbsolute(src) ?
3838
path.join(options.root, src) :
39-
path.resolve(cwd, src)
39+
path.resolve(cwd, src);
4040
source = fs.readFileSync(src, options.encoding);
4141

4242
try {
43-
const localsRaw = node.attrs.locals || (node.content ? node.content.join().replace(/\n/g, '') : false);
43+
const localsRaw =
44+
node.attrs.locals ||
45+
(node.content ? node.content.join().replace(/\n/g, '') : false);
4446
const localsJson = JSON.parse(localsRaw);
4547
posthtmlExpressionsOptions = {
4648
...posthtmlExpressionsOptions,
47-
locals: posthtmlExpressionsOptions.locals ? Object.assign(posthtmlExpressionsOptions.locals, localsJson) : localsJson
49+
locals: posthtmlExpressionsOptions.locals ?
50+
Object.assign(posthtmlExpressionsOptions.locals, localsJson) :
51+
localsJson
4852
};
4953
} catch {}
5054

@@ -65,7 +69,9 @@ module.exports = (options = {}) => {
6569
subtree.match = tree.match;
6670
subtree.parser = tree.parser;
6771
subtree.messages = tree.messages;
68-
content = source.includes('include') ? posthtmlInclude(subtree) : subtree;
72+
content = source.includes('include') ?
73+
posthtmlInclude(subtree) :
74+
subtree;
6975

7076
if (tree.messages) {
7177
tree.messages.push({

0 commit comments

Comments
 (0)