wallet-core/node_modules/normalize-path/index.js

20 lines
505 B
JavaScript
Raw Normal View History

2016-10-10 03:43:44 +02:00
/*!
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
2016-10-10 03:43:44 +02:00
*/
var removeTrailingSeparator = require('remove-trailing-separator');
2016-10-10 03:43:44 +02:00
module.exports = function normalizePath(str, stripTrailing) {
if (typeof str !== 'string') {
throw new TypeError('expected a string');
}
str = str.replace(/[\\\/]+/g, '/');
if (stripTrailing !== false) {
str = removeTrailingSeparator(str);
2016-10-10 03:43:44 +02:00
}
return str;
};