(str: string, sep: string)
| 204 | } |
| 205 | |
| 206 | export 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 */ |
| 217 | export function partition(str: string, sep: string): [string, string] { |
no test coverage detected
searching dependent graphs…