# crush

URL: https://caijiao.org/radash/object/crush
Source: docs/radash/object/crush.md
Description: 将深层对象展平为单维 将深层对象展平为单维

将深层对象展平为单维


## 基本用法

将深层对象展平为单维。深层键将在新对象中转换为点表示法。

```ts
import { crush } from 'radash'

const ra = {
  name: 'ra',
  power: 100,
  friend: {
    name: 'loki',
    power: 80
  },
  enemies: [
    {
      name: 'hathor',
      power: 12
    }
  ]
}

crush(ra)
// {
//   name: 'ra',
//   power: 100,
//   'friend.name': 'loki',
//   'friend.power': 80,
//   'enemies.0.name': 'hathor',
//   'enemies.0.power': 12
// }
```
