@redocly/graphql-docs
Version:
Redocly GraphQL docs
2 lines (1 loc) • 372 B
JavaScript
import{useLocation as l}from"../hooks/use-location.js";import{getLocationId as s,normalizeElementId as o}from"./utils.js";function u(e,{locationMatchDepth:n,elementIdOffset:i}={locationMatchDepth:3,elementIdOffset:1}){const a=l(),t=s(a);if(!t)return{isActive:!1};const c=o(t,{resultParts:n}),r=o(e,{trimLeadingParts:i});return{isActive:c===r}}export{u as useActiveState};