UNPKG

@hashicorp/react-subnav

Version:

Displays a navigation bar, with links and a call-to-action.

14 lines (11 loc) 392 B
/** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ export function areBasePathsMatching(pathA: string, pathB: string) { if (!pathA || !pathB) return false // use .filter(Boolean) to remove any falsy values, like "" const [pathABase] = pathA.split('/').filter(Boolean) const [pathBBase] = pathB.split('/').filter(Boolean) return pathABase === pathBBase }