From aaef4b0ca3b1432101d1ca84cc7b4898ddee7789 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 15 Apr 2021 13:36:58 -0300 Subject: 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. --- upd8.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/upd8.js b/upd8.js index 37b72ae..eec04d7 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) { -- cgit 1.3.0-6-gf8a5