silverwolf-x/project / packages /next /src /shared /lib /page-path /denormalize-page-path.ts
silverwolf-x's picture
download
raw
618 Bytes
import { isDynamicRoute } from '../router/utils'
import { normalizePathSep } from './normalize-path-sep'
/**
* Performs the opposite transformation of `normalizePagePath`. Note that
* this function is not idempotent either in cases where there are multiple
* leading `/index` for the page. Examples:
* - `/index` -> `/`
* - `/index/foo` -> `/foo`
* - `/index/index` -> `/index`
*/
export function denormalizePagePath(page: string) {
let _page = normalizePathSep(page)
return _page.startsWith('/index/') && !isDynamicRoute(_page)
? _page.slice(6)
: _page !== '/index'
? _page
: '/'
}

Xet Storage Details

Size:
618 Bytes
·
Xet hash:
6a41298a6129260e874bfd832f24dea7991084556fb5af8aeaa6bb8a52615580

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.