1 | /*!
|
2 | * Robots
|
3 | * Copyright(c) 2011 Eugene Kalinin
|
4 | * MIT Licensed
|
5 | */
|
6 |
|
7 | var debug = false;
|
8 |
|
9 | exports.d = function (str) {
|
10 | if (debug) {
|
11 | console.log(str);
|
12 | }
|
13 | }
|
14 |
|
15 | // http://stackoverflow.com/questions/946170/equivalent-javascript-functions-for-pythons-urllib-quote-and-urllib-unquote
|
16 | // JavaScript | Python
|
17 | // -----------------------------------
|
18 | // encodeURI(str) | urllib.quote(str, safe='~@#$&()*!+=:;,.?/\'');
|
19 | // -----------------------------------
|
20 | // encodeURIComponent(str) | urllib.quote(str, safe='~()*!.\'')
|
21 | exports.quote = encodeURIComponent;
|
22 | exports.unquote = decodeURIComponent;
|
23 | //exports.quote = encodeURI;
|
24 | //exports.unquote = decodeURI;
|