UNPKG

@knide/fs-prober

Version:

fs-prober is a browser-friendly NPM package for extracting file and folder structures from user-selected files or directories.

5 lines (4 loc) 203 B
export const normalizedPath = (path: string | undefined): string => { const nPath = path?.replace(/\/+$/, "").replace(/\/+/g, "/") // remove trailing slashes and double slashes return nPath || "/" }