Skip to content

hasCurrentRoute

Checks whether the active route name is part of a known list. Use it when a nav item or layout state should be active for several related routes.

Importing

ts
import { hasCurrentRoute } from '@almighty-shogun/vue-utils'

Usage

ts
import { hasCurrentRoute } from '@almighty-shogun/vue-utils'

const isInUsersArea = hasCurrentRoute(['users.index', 'users.show']);

Parameters

NameTypeDescription
routesstring[]Application route names.

Returns

true when the current route name is in routes.

Type signature

ts
declare function hasCurrentRoute(routes: string[]): boolean;

All packages are released under the MIT License.