MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / scan

Function scan

frontend/packages/common/src/utils/curl.ts:372–389  ·  view source on GitHub ↗
(string: string, pattern: RegExp, callback: (match: RegExpMatchArray) => void)

Source from the content-addressed store, hash-verified

370}
371// https://github.com/jimmycuadra/shellwords/blob/main/src/shellwords.ts
372const scan = (string: string, pattern: RegExp, callback: (match: RegExpMatchArray) => void) => {
373 let result = ''
374
375 while (string.length > 0) {
376 const match = string.match(pattern)
377
378 if (match && match.index != null && match[0] != null) {
379 result += string.slice(0, match.index)
380 result += callback(match)
381 string = string.slice(match.index + match[0].length)
382 } else {
383 result += string
384 string = ''
385 }
386 }
387
388 return result
389}
390/**
391 * Splits a string into an array of tokens in the same way the UNIX Bourne shell does.
392 * https://github.com/jimmycuadra/shellwords/blob/main/src/shellwords.ts

Callers 1

splitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected