UNPKG

679 BJavaScriptView Raw
1/*!
2 * Robots
3 * Copyright(c) 2011 Eugene Kalinin
4 * MIT Licensed
5 */
6
7var debug = false;
8
9exports.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='~()*!.\'')
21exports.quote = encodeURIComponent;
22exports.unquote = decodeURIComponent;
23//exports.quote = encodeURI;
24//exports.unquote = decodeURI;