forked from 0x2620/oxjs
add and use Ox.decodeURI and Ox.decodeURIComponent
This commit is contained in:
parent
7576654e0d
commit
51215c1cbe
3 changed files with 20 additions and 2 deletions
|
|
@ -24,6 +24,24 @@ Ox.clean = function(string) {
|
|||
})).join('\n');
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.decodeURIComponent <f> Decodes URI
|
||||
Unlike window.decodeURI, this doesn't throw on trailing '%'.
|
||||
(string) -> <s> Decoded string
|
||||
@*/
|
||||
Ox.decodeURI = function(string) {
|
||||
return decodeURIComponent(string.replace(/%(?![0-7][0-9A-F])/g, '%25'));
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.decodeURIComponent <f> Decodes URI component
|
||||
Unlike window.decodeURIComponent, this doesn't throw on trailing '%'.
|
||||
(string) -> <s> Decoded string
|
||||
@*/
|
||||
Ox.decodeURIComponent = function(string) {
|
||||
return decodeURIComponent(string.replace(/%(?![0-7][0-9A-F])/g, '%25'));
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.endsWith <f> Tests if a string ends with a given substring
|
||||
Equivalent to `new RegExp(Ox.escapeRegExp(substring) + '$').test(string)`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue