zents
Version:
ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.
18 lines • 800 B
JavaScript
;
/*
Source: https://github.com/pillarjs/encodeurl/blob/master/index.js
Copyright(c) 2016 Douglas Christopher Wilson
MIT Licensed
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.encodeUrl = void 0;
const ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g;
const UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g;
const UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2';
function encodeUrl(url) {
return url
.replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
.replace(ENCODE_CHARS_REGEXP, encodeURI);
}
exports.encodeUrl = encodeUrl;
//# sourceMappingURL=encodeUrl.js.map