Bones/node_modules/remove-trailing-separator/index.js
SOUTHERNCO\x2mjbyrn 7efe7605b8 Template Upload
2017-05-17 13:45:25 -04:00

14 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 === '\\'));
}