Skip to content

Instantly share code, notes, and snippets.

@ttchengcheng
Created August 13, 2018 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttchengcheng/96cf3d470104bf0094d45354736dc4ac to your computer and use it in GitHub Desktop.
Save ttchengcheng/96cf3d470104bf0094d45354736dc4ac to your computer and use it in GitHub Desktop.
language independent useful snippet

把连续的字符替换掉, 比如把连续的 '/' 替换为 '/', 来自 这里

const prettyPath = urlObj.pathname.replace(/\/{2,}/g, "/");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment