MCPcopy
hub / github.com/axios/axios / build

Function build

lib/helpers/toFormData.js:252–274  ·  view source on GitHub ↗
(value, path, depth = 0)

Source from the content-addressed store, hash-verified

250 });
251
252 function build(value, path, depth = 0) {
253 if (utils.isUndefined(value)) return;
254
255 throwIfMaxDepthExceeded(depth);
256
257 if (stack.indexOf(value) !== -1) {
258 throw new Error('Circular reference detected in ' + path.join('.'));
259 }
260
261 stack.push(value);
262
263 utils.forEach(value, function each(el, key) {
264 const result =
265 !(utils.isUndefined(el) || el === null) &&
266 visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);
267
268 if (result === true) {
269 build(el, path ? path.concat(key) : [key], depth + 1);
270 }
271 });
272
273 stack.pop();
274 }
275
276 if (!utils.isObject(obj)) {
277 throw new TypeError('data must be an object');

Callers 1

toFormDataFunction · 0.70

Calls 3

throwIfMaxDepthExceededFunction · 0.85
forEachMethod · 0.80
concatMethod · 0.80

Tested by

no test coverage detected