# construct

URL: https://caijiao.org/radash/object/construct
Source: docs/radash/object/construct.md
Description: 从键路径和值构建对象 与 crush 相反，给定一个被压缩成键路径和值的对象，将返回重建的原始对象

从键路径和值构建对象


## 基本用法

与 crush 相反，给定一个被压缩成键路径和值的对象，将返回重建的原始对象。

```ts
import { construct } from 'radash'

const flat = {
  name: 'ra',
  power: 100,
  'friend.name': 'loki',
  'friend.power': 80,
  'enemies.0.name': 'hathor',
  'enemies.0.power': 12
}

construct(flat)
// {
//   name: 'ra',
//   power: 100,
//   friend: {
//     name: 'loki',
//     power: 80
//   },
//   enemies: [
//     {
//       name: 'hathor',
//       power: 12
//     }
//   ]
// }
```
