UNPKG

com-tools

Version:

com-tools 提供了一些通用的工具函数;

104 lines (48 loc) 1.51 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [com-tools](./com-tools.md) &gt; [array\_safelyOperateIndexs](./com-tools.array_safelyoperateindexs.md) ## array\_safelyOperateIndexs() function array\_safelyOperateIndexs(indexList, operation, thisValue) 安全操作指定的索引 **Signature:** ```typescript export declare function array_safelyOperateIndexs<T, ThisValue = T[]>(array: T[], indexList: number[], operation: ArrayCallbackFun<ThisValue, T, void>, thisValue?: ThisValue): T[]; ``` ## 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> indexList </td><td> number\[\] </td><td> : \[Index\] 需要被操作的索引数组 </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:** T\[\] \[Item\] 被操作的元素列表 operation(currentValue,currentIndex,currentArray)=<!-- -->&gt;<!-- -->Void