It looks like its checking if its empty, in which case, shouldn't it be beneficial to short circuit the function and call a return (on the case of it being an empty array)?