UNPKG

compare-path

Version:

An easy-to-use package to detect if two URLs match each other by comparing their abstract paths

13 lines 411 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cleanPath = void 0; /** * Remove any leading/trailing whitespace and slashes adn remove multiple consecutive slashes (/) * anywhere in the path. */ const cleanPath = (path) => path .trim() .replace(/^\/+|\/+$/g, '') .replace(/\/{2,}/g, '/'); exports.cleanPath = cleanPath; //# sourceMappingURL=clean-path.js.map