2017-08-14 05:01:11 +02:00
|
|
|
var isWin = process.platform === 'win32';
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
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 === '\\'));
|
|
|
|
}
|