Change parseHtml to only have a single return statement, a single call
to proxyNode.
Showing
1 changed file
with
6 additions
and
5 deletions
| ... | @@ -386,11 +386,12 @@ const proxyNode = (node, options, parent) => { | ... | @@ -386,11 +386,12 @@ const proxyNode = (node, options, parent) => { |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | export const parseHtml = (html: string, options): NodeType => { | 388 | export const parseHtml = (html: string, options): NodeType => { |
| 389 | const cached = parsedHtmlCache.get(html) | 389 | let cached = parsedHtmlCache.get(html) |
| 390 | if (cached) return proxyNode(cached, options) | 390 | if (!cached) { |
| 391 | const doc = ultraParse(html) | 391 | cached = ultraParse(html) |
| 392 | parsedHtmlCache.set(html, doc) | 392 | parsedHtmlCache.set(html, cached) |
| 393 | return proxyNode(doc, options) | 393 | } |
| 394 | return proxyNode(cached, options) | ||
| 394 | } | 395 | } |
| 395 | 396 | ||
| 396 | export const findNode = (doc: NodeType, selector: string): NodeType => { | 397 | export const findNode = (doc: NodeType, selector: string): NodeType => { | ... | ... |
-
Please register or sign in to post a comment