com-tools
Version:
com-tools 提供了一些通用的工具函数;
88 lines (41 loc) • 1.03 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [com-tools](./com-tools.md) > [moveItemsInNewArray](./com-tools.moveitemsinnewarray.md)
## moveItemsInNewArray() function
在新数组中批量移动数组的元素,不会改变原数组
**Signature:**
```typescript
export declare function moveItemsInNewArray<Item>(arr: Item[], froms: number[], tos: number[]): Item[];
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
arr
</td><td>
Item\[\]
</td><td>
</td></tr>
<tr><td>
froms
</td><td>
number\[\]
</td><td>
</td></tr>
<tr><td>
tos
</td><td>
number\[\]
</td><td>
</td></tr>
</tbody></table>
**Returns:**
Item\[\]
新数组
## Remarks
将数组中的元素 从 from 移动到 to from 与 to 中的索引一一对应
该方法会比 moveItemsInArray 性能更高一些