From 5c238a0571a2f8e589a8c50b6a28b4bcba20938b Mon Sep 17 00:00:00 2001 From: David Chambers Date: Sun, 14 Jan 2024 16:12:00 +0100 Subject: [PATCH] initialize `offset` --- lib/doctest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/doctest.js b/lib/doctest.js index 351037a..48b9e1d 100644 --- a/lib/doctest.js +++ b/lib/doctest.js @@ -123,7 +123,7 @@ const rewriteJs = sourceType => ({ // 2: Preserve source text between comments const chunks = []; { - let offset; + let offset = 0; for (const {start, end} of comments) { chunks.push ([offset, input.slice (offset, start)]); offset = end;