UNPKG

five-server

Version:

Development Server with Live Reload Capability. (Maintained Fork of Live Server)

28 lines 1.2 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.appendPathToUrl = exports.removeTrailingSlash = exports.removeLeadingSlash = exports.escape = exports.splitLines = void 0; const escape_html_1 = __importDefault(require("./dependencies/escape-html")); // https://docs.python.org/3/library/stdtypes.html#str.splitlines const splitLines = (str) => { return str.replace(/\r\n|\r|\n/gm, ''); }; exports.splitLines = splitLines; const escape = html => (0, escape_html_1.default)(html); exports.escape = escape; const removeLeadingSlash = (str) => { return str.replace(/^\/+/g, ''); }; exports.removeLeadingSlash = removeLeadingSlash; const removeTrailingSlash = (str) => { return str.replace(/\/+$/g, ''); }; exports.removeTrailingSlash = removeTrailingSlash; /** Just like path.join() (for url) */ const appendPathToUrl = (url, append) => { return `${(0, exports.removeTrailingSlash)(url)}/${(0, exports.removeLeadingSlash)(append)}`; }; exports.appendPathToUrl = appendPathToUrl; //# sourceMappingURL=helpers.js.map