Native encodeURIComponent
doesn't support encoding exclamation mark - !
which I need to have in url's query param encoded properly..
node.js querystring.stringify()
doesn't it as well..
is the only way to use custom function like - https://github.com/kvz/phpjs/blob/master/functions/url/urlencode.js#L30 ?
You could re-define the native function to add that functionality.
Here's an example of extending
encodeURIComponent
to handle exclamation marks.You could also add a new function, if you wanted the code to be shorter.
That's up to you, though.
More examples of this can be found at Mozilla's dev site