Front end of the Slack clone application.

index.js 505B

1234567891011121314151617181920
  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. };