Skip to content

containsRoutePrefix

Checks whether the current route name starts with a prefix. This is useful for grouping route names by feature area, such as settings.profile and settings.security.

Importing

ts
import { containsRoutePrefix } from '@almighty-shogun/common'

Usage

ts
import { containsRoutePrefix } from '@almighty-shogun/common'

const isSettingsPage = containsRoutePrefix('settings.');

Parameters

prefix: string
Route name prefix.

Returns

true when the current route name starts with prefix.

Type signature

ts
declare function containsRoutePrefix(prefix: string): boolean;

All packages are released under the MIT License.