20 lines
496 B
TypeScript
Raw Permalink Normal View History

2024-02-18 01:44:48 -05:00
// ** Types
import { NextRouter } from 'next/router'
/**
* Check for URL queries as well for matching
* Current URL & Item Path
*
* @param item
* @param activeItem
*/
export const handleURLQueries = (router: NextRouter, path: string | undefined): boolean => {
if (Object.keys(router.query).length && path) {
const arr = Object.keys(router.query)
return router.asPath.includes(path) && router.asPath.includes(router.query[arr[0]] as string) && path !== '/'
}
return false
}