mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-17 06:20:31 +00:00
13 lines
397 B
JavaScript
13 lines
397 B
JavaScript
var quoteRegExp = function (str) {
|
|
return (str + '').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
|
|
};
|
|
var re = new RegExp(quoteRegExp(require("path").sep), "g");
|
|
|
|
/**
|
|
* Normalize path separators to forward slashes
|
|
* @param path A path in either Windows or POSIX format
|
|
* @returns {string} A path in POSIX format
|
|
*/
|
|
module.exports = function (path) {
|
|
return ("" + path).replace(re, "/");
|
|
};
|