UNPKG

@jsenv/util

Version:

Set of functions often needed when using Node.js.

9 lines (7 loc) 207 B
export const pathnameToParentPathname = (pathname) => { const slashLastIndex = pathname.lastIndexOf("/") if (slashLastIndex === -1) { return "/" } return pathname.slice(0, slashLastIndex + 1) }