filterIndexed
See original GitHub issueIs your feature request related to a problem? Please describe.
R.filter doesn’t expose index to the predicate function. Let’s create a function that does and call it filterIndexed
.
Describe the solution you’d like
filterIndexed((v, idx) => idx === 0, [1, 2, 3); // => [1]
Possible implementation
const filterIndexed = R.addIndex(R.filter);
Describe alternatives you’ve considered
–
Additional context
–
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
filterIndexed - Kotlin Programming Language
Returns a list containing only elements matching the given predicate. import kotlin.test.* fun main(args: Array<String>) { //sampleStart val numbers: List<Int> ...
Read more >Kotlin filter lambda array using iteration index
filterIndexed function is suited exactly for this case: array.filterIndexed { index, value -> index % n == 0 }.
Read more >How to access Index of Element while Filtering Kotlin List?
To access index of the elements while filtering elements in a Kotlin List, use filterIndexed() function. For each element in the List, the...
Read more >filterIndexed - Kotlin Programming Language
Returns a list containing only elements matching the given predicate. Parameters. predicate - function that takes the index of an element and the...
Read more >filterIndexed - kotlin.collections - W3cubDocs
Returns a list containing only elements matching the given predicate. import kotlin.test.* fun main(args: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jprask sure, go ahead!
@char0n Yeah, my apologies on the delay here, ended up busy with some parallel stuff. Starting it now.