Adds $tw.utils.decodeURISafe and $tw.utils.decodeURIComponentSafe (#5999)

* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fixes decodeURI & decodeURIComponent
This commit is contained in:
Joshua Fontany 2021-08-29 05:39:32 -07:00 committed by GitHub
parent a67b1b8bb5
commit 33eef0202d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 41 additions and 33 deletions

View file

@ -969,4 +969,22 @@ exports.makeCompareFunction = function(type,options) {
return (types[type] || types[options.defaultType] || types.number);
};
exports.decodeURIComponentSafe = function(str) {
var value = str;
try {
value = decodeURIComponent(str);
} catch(e) {
}
return value;
};
exports.decodeURISafe = function(str) {
var value = str;
try {
value = decodeURI(str);
} catch(e) {
}
return value;
};
})();