Skip to content

Commit ea930d0

Browse files
committed
chore(*): fix code style
1 parent 912b8eb commit ea930d0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/api.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ function traverse(tree, cb) {
7474
if (Array.isArray(tree)) {
7575
for (let i = 0, l = tree.length; i < l; i++) {
7676
let item = tree[i];
77-
if (typeof(item) !== 'object') {
77+
if (typeof item !== 'object') {
7878
tree[i] = traverse(item, cb);
7979
} else {
8080
tree[i] = traverse(cb(item), cb);
8181
}
8282
}
83-
} else if (typeof(tree) === 'object') {
83+
} else if (typeof tree === 'object') {
8484
if (tree.hasOwnProperty('content')) traverse(tree.content, cb);
8585
} else {
8686
return cb(tree);
@@ -89,11 +89,11 @@ function traverse(tree, cb) {
8989
}
9090

9191
function compare(expected, actual) {
92-
if (typeof(actual) !== typeof(expected)) {
92+
if (typeof actual !== typeof expected) {
9393
return false;
9494
}
9595

96-
if (typeof(expected) !== 'object' || expected === null) {
96+
if (typeof expected !== 'object' || expected === null) {
9797
return expected === actual;
9898
}
9999

@@ -102,7 +102,7 @@ function compare(expected, actual) {
102102
}
103103

104104
if (Array.isArray(expected)) {
105-
if (typeof(actual.length) !== 'number') {
105+
if (typeof actual.length !== 'number') {
106106
return false;
107107
}
108108
let aa = Array.prototype.slice.call(actual);
@@ -112,10 +112,10 @@ function compare(expected, actual) {
112112
return Object.keys(expected).every(key => {
113113
let eo = expected[key];
114114
let ao = actual[key];
115-
if (typeof(eo) === 'object' && eo !== null && ao !== null) {
115+
if (typeof eo === 'object' && eo !== null && ao !== null) {
116116
return compare(eo, ao);
117117
}
118-
if (typeof(eo) === 'boolean') {
118+
if (typeof eo === 'boolean') {
119119
return (eo && ao) || (!eo && !ao);
120120
}
121121
return ao === eo;

lib/parser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ export default {
114114

115115
function html(tree) {
116116

117-
if(typeof(tree) === 'string') {
117+
if(typeof tree === 'string') {
118118
return tree;
119119
}
120120

121121
let buf = '';
122122

123123
walk.call([].concat(tree), node => {
124124
if(!node) return;
125-
if(typeof(node) === 'string') {
125+
if(typeof node === 'string') {
126126
buf += node;
127127
return;
128128
}
@@ -158,7 +158,7 @@ export default {
158158
let attr = '';
159159
for (let key in obj) {
160160
attr += ` ${key}${
161-
obj[key] && typeof(obj[key]) !== 'boolean'?
161+
obj[key] && typeof obj[key] !== 'boolean'?
162162
`="${obj[key]}"`:
163163
''
164164
}`;

0 commit comments

Comments
 (0)