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

Function rpartition

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

Source from the content-addressed store, hash-verified

204}
205
206export function rpartition(str: string, sep: string): [string, string] {
207 const lastIndex = str.lastIndexOf(sep);
208 if (lastIndex === -1) {
209 return ["", str];
210 }
211 const before = str.slice(0, lastIndex);
212 const after = str.slice(lastIndex + sep.length);
213 return [before, after];
214}
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] {

Callers 2

extractProcessNameFunction · 0.90
parseSpecFunction · 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…