UNPKG

@router-cli/react-router-dev

Version:

File based routing cli for react-router-dom.

18 lines (15 loc) 464 B
export const trimCharEnd = (src: string, char: string) => { while (src.endsWith(char)) { src = src.slice(0, src.length - char.length); } return src; } export const trimCharStart = (src: string, char: string) => { while (src.startsWith(char)) { src = src.slice(char.length); } return src; } export const trimChar = (src: string, char: string) => { return trimCharEnd(trimCharStart(src, char), char); }