-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEATURE add includes
Eel Helpers for String and Array
#3359
base: 8.4
Are you sure you want to change the base?
Conversation
FYI just made this wip because it has to land in 8.4 but were working on branching it of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!. I havent checked but the includes
was just an example case.
Are there more helpful helpers that were missing?
Also i think we talked about that String.substr
is deprecated in ecmascript and we should probably also add all deprecations like this here.
Or if you dont have the time for it we could of course only include those two helpers ... ^^
if ($array instanceof \Traversable) { | ||
$array = iterator_to_array($array); | ||
} | ||
return in_array($searchElement, (array)array_slice($array, $fromIndex)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably use the 3 param (strict) to true or is the proposed way closer to ECMASCRIPT?
... also the (array)
casts looks a little weird and im wondering in general if we should optimize and early return for the fromIndex=0
case?
includes
Eel Helpers for String and Array
resolved:#2967
Added two new EelHelpers following the interface of the JavaScript functions String.prototype.includes() and Array.prototype.includes()
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions