Do not filter body ranges if there are none

This commit is contained in:
Josh Perez 2021-04-28 14:48:52 -07:00 committed by GitHub
parent 965c635905
commit 6eba9350be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,6 +92,10 @@ function getFilteredBodyRanges(
body: string,
bodyRanges: BodyRangesType
): BodyRangesType {
if (!bodyRanges.length) {
return [];
}
// Find where the snippet starts in the full text
const stripped = snippet
.replace(/<<left>>/g, '')