<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [com-tools](./com-tools.md) &gt; [array\_safelyOperateItems](./com-tools.array_safelyoperateitems.md)

## array\_safelyOperateItems() function

array\_safelyOperateItems(itemList, operation, thisValue) 安全操作指定的元素

**Signature:**

```typescript
export declare function array_safelyOperateItems<T, ThisValue = T[]>(array: T[], itemList: T[], operation: ArrayCallbackFun<ThisValue, T, void>, thisValue?: ThisValue): number[];
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

array


</td><td>

T\[\]


</td><td>


</td></tr>
<tr><td>

itemList


</td><td>

T\[\]


</td><td>

: \[Item\] 需要被操作的元素的数组


</td></tr>
<tr><td>

operation


</td><td>

[ArrayCallbackFun](./com-tools.arraycallbackfun.md)<!-- -->&lt;ThisValue, T, void&gt;


</td><td>

: (currentValue,currentIndex,currentArray)=<!-- -->&gt;<!-- -->Void 执行的操作


</td></tr>
<tr><td>

thisValue


</td><td>

ThisValue


</td><td>

_(Optional)_ ? : any 可选，默认值是被操作的数组，即调用者；操作 operation 的 this 值


</td></tr>
</tbody></table>
**Returns:**

number\[\]

\[Index\] 被操作的元素的索引的列表；

operation(currentValue,currentIndex,currentArray)=<!-- -->&gt;<!-- -->Void

