Mods/node_modules/remove-trailing-separator/index.js
oitsjustjose 6b60015c02 --
2017-02-26 17:06:42 -05:00

13 lines
294 B
JavaScript

const isWin = process.platform === 'win32';
module.exports = function (str) {
while (endsInSeparator(str)) {
str = str.slice(0, -1);
}
return str;
};
function endsInSeparator(str) {
var last = str[str.length - 1];
return str.length > 1 && (last === '/' || (isWin && last === '\\'));
}