Version: v0.7.1 - Beta.  We welcome contributors & feedback.

List.hasIndex

hasIndex($index) -> boolean

Description

Return true if the List contains a value at the given $index.

If $index is negative, it counts from the end of the list (the last item is at -1).

['a', 'b', 'c'].hasIndex(1)
//=  true

['a', 'b', 'c'].hasIndex(-1)
//=  true

['a', 'b', 'c'].hasIndex(100)
//=  false

[].hasIndex(0)
//=  false

See Also