source: trip-planner-front/node_modules/tar/lib/strip-trailing-slashes.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 394 bytes
Line 
1// warning: extremely hot code path.
2// This has been meticulously optimized for use
3// within npm install on large package trees.
4// Do not edit without careful benchmarking.
5module.exports = str => {
6 let i = str.length - 1
7 let slashesStart = -1
8 while (i > -1 && str.charAt(i) === '/') {
9 slashesStart = i
10 i--
11 }
12 return slashesStart === -1 ? str : str.slice(0, slashesStart)
13}
Note: See TracBrowser for help on using the repository browser.