UNPKG

antd-mini

Version:

antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。

18 lines (15 loc) 490 B
export function flattenObject(obj, parentKey = '', result = {}) { for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { const currentKey = parentKey ? `${parentKey}.${key}` : key; const value = obj[key]; if (Object.prototype.toString.call(value) === '[object Object]') { flattenObject(value, currentKey, result); } else { result[currentKey] = value; } } } return result; } export default flattenObject;