MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / partition

Function partition

web/src/js/utils.ts:217–225  ·  view source on GitHub ↗
(str: string, sep: string)

Source from the content-addressed store, hash-verified

215
216/** A JS equivalent of Python's https://docs.python.org/3/library/stdtypes.html#str.partition */
217export function partition(str: string, sep: string): [string, string] {
218 const index = str.indexOf(sep);
219 if (index === -1) {
220 return [str, ""];
221 }
222 const before = str.slice(0, index);
223 const after = str.slice(index + sep.length);
224 return [before, after];
225}
226
227/* istanbul ignore next @preserve */
228export function assertNever(val: never): never {

Callers 2

parseSpecFunction · 0.90
parseRawFunction · 0.90

Calls 1

sliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…