What does index() return on failure?


#1

Im filtering a list of logs by a list of given eids and would like to use the index() operator as the condition of the filter. Like
return = logs.filter(log){ eids.index(log{“eid”}) };
Would I need to compare the index with -1?


#2

Yes, the index() operator returns -1 if no match is found. The documentation for index() has been updated to indicate this.

return = logs.filter(log){ eids.index(log{"eid"}) != -1 };