UNPKG

com-tools

Version:

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

86 lines (40 loc) 1.39 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [com-tools](./com-tools.md) &gt; [array\_filterIndexs](./com-tools.array_filterindexs.md) ## array\_filterIndexs() function filterIndexs(filterTest,thisArg) 该方法创建一个新的数组,新数组中的元素是通过检查指定数组中符合条件的所有元素的索引。 **Signature:** ```typescript export declare function array_filterIndexs<T, ThisValue = T[]>(array: T[], filterTest: ArrayCallbackFun<ThisValue, T, any>, 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> filterTest </td><td> [ArrayCallbackFun](./com-tools.arraycallbackfun.md)<!-- -->&lt;ThisValue, T, any&gt; </td><td> : (currentValue,index,arr)=<!-- -->&gt;<!-- -->boolean 用来测试数组的每个元素的函数。调用时使用参数 (currentValue,index,arr)。返回true表示保留该元素(通过测试),false则不保留 </td></tr> <tr><td> thisValue </td><td> ThisValue </td><td> _(Optional)_ </td></tr> </tbody></table> **Returns:** number\[\] Array<Index> 通过测试的元素的索引