( from: Array<I> | O )
| 5 | export default function shallowCopy<I>(from: Array<I>): Array<I>; |
| 6 | export default function shallowCopy<O extends object>(from: O): O; |
| 7 | export default function shallowCopy<I, O extends object>( |
| 8 | from: Array<I> | O |
| 9 | ): Array<I> | O { |
| 10 | if (Array.isArray(from)) { |
| 11 | return arrCopy(from); |
| 12 | } |
| 13 | const to: Partial<O> = {}; |
| 14 | for (const key in from) { |
| 15 | if (isProtoKey(key)) { |
| 16 | continue; |
| 17 | } |
| 18 | |
| 19 | if (hasOwnProperty.call(from, key)) { |
| 20 | to[key] = from[key]; |
| 21 | } |
| 22 | } |
| 23 | return to as O; |
| 24 | } |
no test coverage detected