2
0

normalize-path.js 397 B

12345678910111213
  1. var quoteRegExp = function (str) {
  2. return (str + '').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
  3. };
  4. var re = new RegExp(quoteRegExp(require("path").sep), "g");
  5. /**
  6. * Normalize path separators to forward slashes
  7. * @param path A path in either Windows or POSIX format
  8. * @returns {string} A path in POSIX format
  9. */
  10. module.exports = function (path) {
  11. return ("" + path).replace(re, "/");
  12. };