MCPcopy Index your code
hub / github.com/github/docs / getIndicesOf

Function getIndicesOf

script/check-github-github-links.js:206–220  ·  view source on GitHub ↗
(searchString, string)

Source from the content-addressed store, hash-verified

204}
205
206function getIndicesOf(searchString, string) {
207 const searchStrLen = searchString.length
208 if (searchStrLen === 0) return []
209
210 let startIndex = 0
211 let index
212 const indices = []
213
214 while ((index = string.indexOf(searchString, startIndex)) > -1) {
215 indices.push(index)
216 startIndex = index + searchStrLen
217 }
218
219 return indices
220}
221
222function regexIndexOf(string, regex, startPos) {
223 const indexOf = string.substring(startPos || 0).search(regex)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected