Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
strip-trailing-slashes.js18 linesDownload Raw Back to commonjs
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.stripTrailingSlashes = void 0;
4// warning: extremely hot code path.
5// This has been meticulously optimized for use
6// within npm install on large package trees.
7// Do not edit without careful benchmarking.
8const stripTrailingSlashes = (str) => {
9    let i = str.length - 1;
10    let slashesStart = -1;
11    while (i > -1 && str.charAt(i) === '/') {
12        slashesStart = i;
13        i--;
14    }
15    return slashesStart === -1 ? str : str.slice(0, slashesStart);
16};
17exports.stripTrailingSlashes = stripTrailingSlashes;
18//# sourceMappingURL=strip-trailing-slashes.js.map
codekingpro/portable-devtools · Team Ai