UNPKG

@fenderdigital/react-menu

Version:

Fender React UI Kit Menu Component

17 lines (15 loc) 449 B
/** * Compares the path name with the url, and returns * true if a match exists. This enables menu items to have an * active color style. * * @param {String} pathname * @param {Object} item * @return {Boolean} */ function isActiveMenuItem(pathname: string, url: string): boolean { if (!pathname || !url) return false; if (pathname.indexOf(url) !== -1 || pathname === url) return true; return false; } export default isActiveMenuItem;