withoutBase #

Takes the site base off a path, or returns undefined when the path is not under it.

Usage #

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

Parameters

pathstring

The path, for example /docs/guide/start.

basestring

The site base, for example /docs/.

Returns The site path, for example /guide/start.

Full type signature
TypeScript
function withoutBase(path: string, base: string): string | undefined

Edit this page

Comments