.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / normalize-path / index.js
1 /*!
2  * normalize-path <https://github.com/jonschlinkert/normalize-path>
3  *
4  * Copyright (c) 2014-2017, Jon Schlinkert.
5  * Released under the MIT License.
6  */
7
8 var removeTrailingSeparator = require('remove-trailing-separator');
9
10 module.exports = function normalizePath(str, stripTrailing) {
11   if (typeof str !== 'string') {
12     throw new TypeError('expected a string');
13   }
14   str = str.replace(/[\\\/]+/g, '/');
15   if (stripTrailing !== false) {
16     str = removeTrailingSeparator(str);
17   }
18   return str;
19 };