Skip to content

Commit 7f61f97

Browse files
perf(index): return empty array if first argument is empty string
1 parent 7a82b3d commit 7f61f97

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

index.js

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ function HTMLReactParser(html, options) {
1616
if (typeof html !== 'string') {
1717
throw new TypeError('First argument must be a string');
1818
}
19+
if (html === '') {
20+
return [];
21+
}
1922
return domToReact(htmlToDOM(html, domParserOptions), options);
2023
}
2124

0 commit comments

Comments
 (0)