(chain: Array<object>)
| 40 | } |
| 41 | |
| 42 | export function createObjectFromChain(chain: Array<object>) { |
| 43 | return chain |
| 44 | .filter(item => item) |
| 45 | .reduce((proto, value) => { |
| 46 | proto = proto || Object.prototype; |
| 47 | if (Object.isFrozen(proto)) { |
| 48 | proto = cloneObject(proto); |
| 49 | } |
| 50 | |
| 51 | return Object.assign( |
| 52 | Object.create(proto, { |
| 53 | __super: { |
| 54 | value: proto, |
| 55 | writable: false, |
| 56 | enumerable: false |
| 57 | } |
| 58 | }), |
| 59 | value |
| 60 | ); |
| 61 | }); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * 向最近一层插入新链 |
no test coverage detected