.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / remove-trailing-separator / index.js
1 var isWin = process.platform === 'win32';
2
3 module.exports = function (str) {
4         var i = str.length - 1;
5         if (i < 2) {
6                 return str;
7         }
8         while (isSeparator(str, i)) {
9                 i--;
10         }
11         return str.substr(0, i + 1);
12 };
13
14 function isSeparator(str, i) {
15         var char = str[i];
16         return i > 0 && (char === '/' || (isWin && char === '\\'));
17 }