MCPcopy Index your code
hub / github.com/wendux/fly / _encode

Function _encode

miniprogram_dist/engine-wrapper.js:158–181  ·  view source on GitHub ↗
(sub, path)

Source from the content-addressed store, hash-verified

156 }
157
158 function _encode(sub, path) {
159 var encode = that.encode;
160 var type = that.type(sub);
161 if (type == "array") {
162 sub.forEach(function (e, i) {
163 if (!that.isObject(e)) i = "";
164 _encode(e, path + ('%5B' + i + '%5D'));
165 });
166 } else if (type == "object") {
167 for (var key in sub) {
168 if (path) {
169 _encode(sub[key], path + "%5B" + encode(key) + "%5D");
170 } else {
171 _encode(sub[key], encode(key));
172 }
173 }
174 } else {
175 if (!first) {
176 str += "&";
177 }
178 first = false;
179 str += path + "=" + encode(sub);
180 }
181 }
182
183 _encode(data, "");
184 return str;

Callers 1

engine-wrapper.jsFile · 0.70

Calls 1

encodeFunction · 0.85

Tested by

no test coverage detected