Goldziher / go-utils

Simple and performant utilies using Go generics inspired by JavaScript and Python
https://goldziher.github.io/go-utils/
MIT License
46 stars 13 forks source link

Fix FindLastIndex function to iterate over the entire slice #48

Closed dan1elhughes closed 3 months ago

dan1elhughes commented 3 months ago

FindLastIndex wasn't finding the index if the matching element was in position zero due to an i > 0 iteration condition that should be i >= 0.

Added a test case that fails without this fix.