withoutBase #

把站点的 base 从路径上去掉;路径不在 base 之下时返回 undefined。

用法 #

TypeScript
import { 
withoutBase
} from 'kawapress'
const
route
=
withoutBase
('/docs/guide/start', '/docs/')

参数

pathstring

路径,例如 /docs/guide/start。

basestring

站点的 base,例如 /docs/。

返回值 站点路径,例如 /guide/start。

完整类型签名
TypeScript
function withoutBase(path: string, base: string): string | undefined

编辑此页

评论