19 lines
611 B
JavaScript
19 lines
611 B
JavaScript
|
"use strict";
|
||
|
var URIComponentEncoder = (function () {
|
||
|
function URIComponentEncoder() {
|
||
|
}
|
||
|
URIComponentEncoder.prototype.getDisplayname = function () {
|
||
|
return "Encode URI component";
|
||
|
};
|
||
|
URIComponentEncoder.prototype.getId = function () {
|
||
|
return "uricomponentencode";
|
||
|
};
|
||
|
URIComponentEncoder.prototype.convert = function (input) {
|
||
|
return encodeURIComponent(input).replace(/[!'()*]/g, function (c) {
|
||
|
return '%' + c.charCodeAt(0).toString(16);
|
||
|
});
|
||
|
};
|
||
|
return URIComponentEncoder;
|
||
|
}());
|
||
|
exports.URIComponentEncoder = URIComponentEncoder;
|