elm-community / list-extra

Convenience functions for working with List.
http://package.elm-lang.org/packages/elm-community/list-extra/latest
MIT License
135 stars 59 forks source link

isInfixOf returns incorrect result when a partial match is found before a complete match #132

Closed mthiems closed 4 years ago

mthiems commented 4 years ago

In version 8.2.2 Small example, shown in repl:

> List.Extra.isInfixOf [1,2] [1,3,1,2]
False : Bool

It should return True .

The problem is that the implementation switches to isPrefixOf as soon as a single item matches.

pzp1997 commented 4 years ago

Good catch! I just opened a PR with a fix.

Chadtech commented 4 years ago

Thank you @mthiems for reporting. And thank you @pzp1997 for fixing.