123456789101112131415161718192021222324 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.parsePath = parsePath;
- function parsePath(path) {
- const hashIndex = path.indexOf('#');
- const queryIndex = path.indexOf('?');
- const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex);
- if (hasQuery || hashIndex > -1) {
- return {
- pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),
- query: hasQuery ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined) : '',
- hash: hashIndex > -1 ? path.slice(hashIndex) : ''
- };
- }
- return {
- pathname: path,
- query: '',
- hash: ''
- };
- }
- //# sourceMappingURL=parse-path.js.map
|