MCPcopy Index your code
hub / github.com/YMFE/yapi / handleExistId

Method handleExistId

exts/yapi-plugin-export-data/controller.js:41–69  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

39 }
40
41 handleExistId(data) {
42 function delArrId(arr, fn) {
43 if (!Array.isArray(arr)) return;
44 arr.forEach(item => {
45 delete item._id;
46 delete item.__v;
47 delete item.uid;
48 delete item.edit_uid;
49 delete item.catid;
50 delete item.project_id;
51
52 if (typeof fn === 'function') fn(item);
53 });
54 }
55
56 delArrId(data, function(item) {
57 delArrId(item.list, function(api) {
58 delArrId(api.req_body_form);
59 delArrId(api.req_params);
60 delArrId(api.req_query);
61 delArrId(api.req_headers);
62 if (api.query_path && typeof api.query_path === 'object') {
63 delArrId(api.query_path.params);
64 }
65 });
66 });
67
68 return data;
69 }
70
71 async exportData(ctx) {
72 let pid = ctx.request.query.pid;

Callers 1

exportDataMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected