Skip to content

Commit 1da416d

Browse files
committed
Added optional offset option to multiLinePatternMatch utility.
1 parent 3b089b0 commit 1da416d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/doxdox-core/src/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ export const isFile = async (path: string): Promise<boolean> => {
163163

164164
export const multiLinePatternMatch = (
165165
content: string,
166-
pattern: string
166+
pattern: string,
167+
offset = 0
167168
): { start?: number; end?: number; matched: boolean } => {
168169
const matched = content.includes(pattern);
169170

@@ -174,7 +175,7 @@ export const multiLinePatternMatch = (
174175
const contentLines = content.split(/\r?\n/);
175176
const patternLines = pattern.split(/\r?\n/);
176177

177-
for (let i = 0; i < contentLines.length; i += 1) {
178+
for (let i = offset; i < contentLines.length; i += 1) {
178179
if (contentLines[i] === patternLines[0]) {
179180
const contentGroup = contentLines
180181
.slice(i, i + patternLines.length)

0 commit comments

Comments
 (0)