Urara-Blog/node_modules/.pnpm-store/v3/files/48/418cdbe39a3a0af36fc309f9ce26c02294d2b62fcf59b4ebd71c7cb177ffc367a3d94e3a9f5d0f252bd5c62cf00492ef1532cf28432dc450216812cee447c6
2022-08-14 01:14:53 +08:00

21 lines
959 B
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeDuplicateSlashes = exports.transform = void 0;
/**
* Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
* The latter is due to the presence of the device path at the beginning of the UNC path.
* @todo rewrite to negative lookbehind with the next major release.
*/
const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
function transform(patterns) {
return patterns.map((pattern) => removeDuplicateSlashes(pattern));
}
exports.transform = transform;
/**
* This package only works with forward slashes as a path separator.
* Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
*/
function removeDuplicateSlashes(pattern) {
return pattern.replace(DOUBLE_SLASH_RE, '/');
}
exports.removeDuplicateSlashes = removeDuplicateSlashes;