MCPcopy Create free account
hub / github.com/RubaXa/Pilot / _stringifyParam

Function _stringifyParam

Pilot.js:28–46  ·  view source on GitHub ↗
(key, val, indexes)

Source from the content-addressed store, hash-verified

26
27
28 function _stringifyParam(key, val, indexes) {
29 /* jshint eqnull:true */
30 if (val == null || val === '' || typeof val !== 'object') {
31 return encodeURIComponent(key) +
32 (indexes ? '[' + indexes.join('][') + ']' : '') +
33 (val == null || val === '' ? '' : '=' + encodeURIComponent(val));
34 }
35 else {
36 var pairs = [];
37
38 for (var i in val) {
39 if (val.hasOwnProperty(i)) {
40 pairs.push(_stringifyParam(key, val[i], (indexes || []).concat(i >= 0 ? '' : encodeURIComponent(i))));
41 }
42 }
43
44 return pairs.join('&');
45 }
46 }
47
48
49 /**

Callers 1

Pilot.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected