UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

25 lines (22 loc) 636 B
import _typeof from '@babel/runtime/helpers/typeof'; function updateChildId(data) { if (data === null || data === void 0 ? void 0 : data.child_id_new) { data.child_id = data.child_id_new; } } function traverseResp(data) { var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : updateChildId; if (_typeof(data) === 'object') { cb(data); if (Array.isArray(data)) { data.forEach(function (item) { return traverseResp(item); }); } else { Object.values(data).forEach(function (item) { return traverseResp(item); }); } } } export { traverseResp };