MCPcopy Index your code
hub / github.com/crisxuan/bestJavaer / normalizeHashHref

Function normalizeHashHref

assets/article-cards.js:376–396  ·  view source on GitHub ↗
(href)

Source from the content-addressed store, hash-verified

374 }
375
376 function normalizeHashHref(href) {
377 var cleanHref = (href || '').trim();
378
379 if (cleanHref.indexOf('#/') > -1) {
380 cleanHref = '#/' + cleanHref.split('#/')[1];
381 }
382
383 cleanHref = cleanHref.split('?')[0].replace(/\.md$/i, '').replace(/\/+$/, '');
384
385 if (cleanHref === '#') {
386 cleanHref = '#/';
387 }
388
389 try {
390 cleanHref = decodeURIComponent(cleanHref);
391 } catch (error) {
392 return cleanHref;
393 }
394
395 return cleanHref || '#/';
396 }
397
398 function normalizeRoute(route) {
399 var normalized = (route || '').replace(/^\/+/, '').replace(/\.md$/i, '').replace(/\/+$/, '');

Callers 3

findSidebarLinkFunction · 0.85
syncSidebarActiveStateFunction · 0.85
getActiveSidebarHrefFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected