Initial commit
[yaffs-website] / node_modules / normalize-path / index.js
1 /*!
2  * normalize-path <https://github.com/jonschlinkert/normalize-path>
3  *
4  * Copyright (c) 2014-2015, Jon Schlinkert.
5  * Licensed under the MIT License
6  */
7
8 module.exports = function normalizePath(str, stripTrailing) {
9   if (typeof str !== 'string') {
10     throw new TypeError('expected a string');
11   }
12   str = str.replace(/[\\\/]+/g, '/');
13   if (stripTrailing !== false) {
14     str = str.replace(/\/$/, '');
15   }
16   return str;
17 };