Skip to content

Commit

Permalink
perf(index): return empty array if first argument is empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jun 3, 2020
1 parent 7a82b3d commit 7f61f97
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ function HTMLReactParser(html, options) {
if (typeof html !== 'string') {
throw new TypeError('First argument must be a string');
}
if (html === '') {
return [];
}
return domToReact(htmlToDOM(html, domParserOptions), options);
}

Expand Down

0 comments on commit 7f61f97

Please sign in to comment.