(str: string, sep: string)
| 215 | |
| 216 | /** A JS equivalent of Python's https://docs.python.org/3/library/stdtypes.html#str.partition */ |
| 217 | export 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 */ |
| 228 | export function assertNever(val: never): never { |