8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 582e7ac commit c037a61Copy full SHA for c037a61
src/documentation/extracts.test.ts
@@ -25,6 +25,9 @@ describe("contextExtracts", () => {
25
{ type: "match", extract: "match" },
26
]);
27
});
28
+ it("no match", () => {
29
+ expect(contextExtracts([], "match", 3)).toEqual([]);
30
+ });
31
it("splits text between matches", () => {
32
expect(
33
contextExtracts(
src/documentation/extracts.ts
@@ -60,6 +60,9 @@ export const contextExtracts = (
60
text: string,
61
context: number = 10
62
): Extract[] => {
63
+ if (positions.length === 0) {
64
+ return [];
65
+ }
66
const extracts = fullStringExtracts(positions, text);
67
return extracts.map((e, index) => {
68
const length = e.extract.length;
0 commit comments