index.js 369 B

123456789101112131415161718
  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. module.exports = function(fp, stripTrailing) {
  8. fp = fp.replace(/[\\\/]+/g, '/');
  9. if (stripTrailing === false) {
  10. return fp;
  11. }
  12. return fp.slice(-1) === '/'
  13. ? fp.slice(0, fp.length -1)
  14. : fp;
  15. };