@@ -8,6 +8,8 @@ var methods = [
8
8
'unescapeBuffer' ,
9
9
'unescape' ,
10
10
'escape' ,
11
+ 'stringify' ,
12
+ 'encode' ,
11
13
] ;
12
14
13
15
methods . forEach ( function ( method ) {
@@ -19,47 +21,6 @@ methods.forEach(function (method) {
19
21
* As of version: https://github.com/iojs/io.js/blob/10e31ba56c676bdcad39ccad22ea9117733b8eb5/lib/querystring.js
20
22
*/
21
23
22
- var stringifyPrimitive = function ( v ) {
23
- if ( typeof v === 'string' )
24
- return v ;
25
- if ( typeof v === 'number' && isFinite ( v ) )
26
- return '' + v ;
27
- if ( typeof v === 'boolean' )
28
- return v ? 'true' : 'false' ;
29
- return '' ;
30
- } ;
31
-
32
- QueryString . stringify = QueryString . encode = function ( obj , sep , eq , options ) {
33
- sep = sep || '&' ;
34
- eq = eq || '=' ;
35
-
36
- var encode = QueryString . escape ;
37
- if ( options && typeof options . encodeURIComponent === 'function' ) {
38
- encode = options . encodeURIComponent ;
39
- }
40
-
41
- if ( obj !== null && typeof obj === 'object' ) {
42
- var keys = Object . keys ( obj ) ;
43
- var len = keys . length ;
44
- var flast = len - 1 ;
45
- var fields = '' ;
46
- for ( var i = 0 ; i < len ; ++ i ) {
47
- var k = keys [ i ] ;
48
- var v = obj [ k ] ;
49
- var ks = encode ( stringifyPrimitive ( k ) ) + eq ;
50
-
51
- if ( Array . isArray ( v ) )
52
- v = v . join ( ',' ) ;
53
-
54
- fields += ks + encode ( stringifyPrimitive ( v ) ) ;
55
- if ( i < flast )
56
- fields += sep ;
57
- }
58
- return fields ;
59
- }
60
- return '' ;
61
- } ;
62
-
63
24
// Parse a key=val string.
64
25
QueryString . parse = QueryString . decode = function ( qs , sep , eq , options ) {
65
26
sep = sep || '&' ;
@@ -89,7 +50,6 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq, options) {
89
50
decode = options . decodeURIComponent ;
90
51
}
91
52
92
- var keys = [ ] ;
93
53
for ( var i = 0 ; i < len ; ++ i ) {
94
54
var x = qs [ i ] . replace ( regexp , '%20' ) ,
95
55
idx = x . indexOf ( eq ) ,
0 commit comments