Instantly share code, notes, and snippets.
把连续的字符替换掉, 比如把连续的 '/' 替换为 '/', 来自 这里
const prettyPath = urlObj.pathname.replace(/\/{2,}/g, "/");