Rocky_Mountain_Vending/.pnpm-store/v10/files/be/d381d53c7177f14ca68a5e21e2c77643c52db9a6391799d5020f64e7db56bc9e83e86af459a12fc5aa91efc057ef4773a16c5e4d1506083754fc3996d3e6e6
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

20 lines
No EOL
904 B
Text

import { normalizePathSep } from './normalize-path-sep';
/**
* Removes the file extension for a page and the trailing `index` if it exists
* making sure to not return an empty string. The page head is not touched
* and returned as it is passed. Examples:
* - `/foo/bar/baz/index.js` -> `/foo/bar/baz`
* - `/foo/bar/baz.js` -> `/foo/bar/baz`
*
* @param pagePath A page to a page file (absolute or relative)
* @param options.extensions Extensions allowed for the page.
* @param options.keepIndex When true the trailing `index` is _not_ removed.
*/ export function removePagePathTail(pagePath, options) {
pagePath = normalizePathSep(pagePath).replace(new RegExp(`\\.+(?:${options.extensions.join('|')})$`), '');
if (options.keepIndex !== true) {
pagePath = pagePath.replace(/\/index$/, '') || '/';
}
return pagePath;
}
//# sourceMappingURL=remove-page-path-tail.js.map