MCPcopy Create free account
hub / github.com/dethcrypto/dethcode / getIndicesOf

Function getIndicesOf

packages/ethereum-viewer/src/fs/textSearchProvider.ts:158–169  ·  view source on GitHub ↗
(pattern: string, text: string)

Source from the content-addressed store, hash-verified

156}
157
158function getIndicesOf(pattern: string, text: string) {
159 let startIndex = 0;
160 let index: number;
161 let indices = [];
162
163 while ((index = text.indexOf(pattern, startIndex)) > -1) {
164 indices.push(index);
165 startIndex = index + 1;
166 }
167
168 return indices;
169}
170
171/**
172 * Replaces _actual newline_ in the pattern with escaped newline.

Callers 1

searchInFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected