MCPcopy Create free account
hub / github.com/Lobos/react-ui / parsePath

Function parsePath

docs/lib/ReactRouter.js:551–577  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

549 }
550
551 function parsePath(path) {
552 var pathname = extractPath(path);
553 var search = '';
554 var hash = '';
555
556 false ? _warning2['default'](path === pathname, 'A path must be pathname + search + hash only, not a fully qualified URL like "%s"', path) : undefined;
557
558 var hashIndex = pathname.indexOf('#');
559 if (hashIndex !== -1) {
560 hash = pathname.substring(hashIndex);
561 pathname = pathname.substring(0, hashIndex);
562 }
563
564 var searchIndex = pathname.indexOf('?');
565 if (searchIndex !== -1) {
566 search = pathname.substring(searchIndex);
567 pathname = pathname.substring(0, searchIndex);
568 }
569
570 if (pathname === '') pathname = '/';
571
572 return {
573 pathname: pathname,
574 search: search,
575 hash: hash
576 };
577 }
578
579/***/ },
580/* 8 */

Callers

nothing calls this directly

Calls 1

extractPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…