You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 505B

12345678910111213141516171819
  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. var removeTrailingSeparator = require('remove-trailing-separator');
  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 = removeTrailingSeparator(str);
  15. }
  16. return str;
  17. };