-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[changed] Combine URL helpers into URL module
- Loading branch information
Showing
4 changed files
with
26 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var urlEncodedSpaceRE = /\+/g; | ||
var encodedSpaceRE = /%20/g; | ||
|
||
var URL = { | ||
|
||
/* These functions were copied from the https://github.com/cujojs/rest source, MIT licensed */ | ||
|
||
decode: function (str) { | ||
// spec says space should be encoded as '+' | ||
str = str.replace(urlEncodedSpaceRE, ' '); | ||
return decodeURIComponent(str); | ||
}, | ||
|
||
encode: function (str) { | ||
str = encodeURIComponent(str); | ||
// spec says space should be encoded as '+' | ||
return str.replace(encodedSpaceRE, '+'); | ||
} | ||
|
||
}; | ||
|
||
module.exports = URL; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.