diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-04-15 13:36:58 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-04-15 13:36:58 -0300 |
commit | aaef4b0ca3b1432101d1ca84cc7b4898ddee7789 (patch) | |
tree | aa9e1950ea57209bcaacb5c1d94331cd94db5b74 | |
parent | 8a0fb4488ccb5dc5c799fe44977ca55edadba3cb (diff) |
remove void parseOneTextNode logic (cur: 84k/sec)
If textOnly is passed, parseNodes will only ever return a single text node, so the other paths were never getting reached. This is only cleanup, though - no significant performance improvement.
-rwxr-xr-x | upd8.js | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/upd8.js b/upd8.js index 37b72ae2..eec04d78 100755 --- a/upd8.js +++ b/upd8.js @@ -992,13 +992,7 @@ const replacerSpec = { stop_literal; const parseOneTextNode = function(input, i, stopAt) { - const nodes = parseNodes(input, i, stopAt, true); - - return ( - nodes.length === 0 ? null : - nodes.length === 1 ? nodes[0] : - makeNode(i, 'text', nodes.map(node => node.string).join(' ')) - ); + return parseNodes(input, i, stopAt, true)[0]; }; const parseNodes = function(input, i, stopAt, textOnly) { |