thoas / go-funk

A modern Go utility library which provides helpers (map, find, contains, filter, ...)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support FindIndex function

HayTran94 opened this issue · comments

commented

If I use Find function, I'll get a object. If I use IndexOf function, the predicate function will not work.

So I want the lib support FindIndex or something like that would help me to find a object with its index. Thank you so much

Does it make sense to just change the Find function to return both index and the object? It might break a lot of existing code, but it makes sense to me

In any case, @thoas do you want this to be added? I'd like to get my hands dirty at it

commented

We should not break existing code, you can send a PR for FindIndex.

@HayTran94 I create this PR for FindKey. #65