mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
perf(parser): optimize v8 perf deoptimizations (#61)
This commit is contained in:
committed by
GitHub
parent
e3727dc5f5
commit
97ecba0af6
@@ -77,7 +77,11 @@ const parse = (input, opts = {}) => {
|
||||
const getNodes = () => {
|
||||
const lastNestedNode = nestedNodes.getLast();
|
||||
|
||||
return lastNestedNode ? lastNestedNode.content : nodes.toArray();
|
||||
if (lastNestedNode && Array.isArray(lastNestedNode.content)) {
|
||||
return lastNestedNode.content;
|
||||
}
|
||||
|
||||
return nodes.toArray();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -85,7 +89,11 @@ const parse = (input, opts = {}) => {
|
||||
* @param {TagNode} tag
|
||||
*/
|
||||
const appendNodes = (tag) => {
|
||||
getNodes().push(tag);
|
||||
const items = getNodes();
|
||||
|
||||
if (Array.isArray(items)) {
|
||||
items.push(tag);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user