Skip to content

Commit fcfc1e9

Browse files
committed
minor improvements
1 parent 10fc685 commit fcfc1e9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

index.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ module.exports = function postHTMLParser(html) {
3434
last.content.push(comment);
3535
},
3636
onopentag: function(tag, attrs) {
37-
var buf = {};
38-
39-
buf.tag = tag;
37+
var buf = { tag: tag };
4038

4139
if (Object.keys(attrs).length) {
4240
buf.attrs = attrs;
@@ -47,15 +45,16 @@ module.exports = function postHTMLParser(html) {
4745
onclosetag: function() {
4846
var buf = bufArray.pop();
4947

50-
if (bufArray.length === 0) {
48+
if (!bufArray.length) {
5149
results.push(buf);
5250
return;
5351
}
5452

5553
var last = bufArray.last();
56-
if (!(last.content instanceof Array)) {
54+
if (!Array.isArray(last.content)) {
5755
last.content = [];
5856
}
57+
5958
last.content.push(buf);
6059
},
6160
ontext: function(text) {

0 commit comments

Comments
 (0)