-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implemented {Array, TypedArray}.prototype.{with, toReversed, toSorted} (#26, #27, #28, #29) #39
Conversation
grafana#26, grafana#27, grafana#28, grafana#29) `{Array, TypedArray}.prototype.toSorted` grafana#26 `{Array, TypedArray}.prototype.toReversed` grafana#27 `{Array, TypedArray}.prototype.with` grafana#28 `Array.prototype.toSpliced` grafana#29
Thank you for the PR @shiroyk 🙇 I will try to review it within the week |
builtin_array.go
Outdated
if int64(cap(src.values)) >= newLength { | ||
values = make([]Value, newLength) | ||
copy(values, src.values[:actualStart]) | ||
copy(values[actualStart+itemCount:], src.values[actualStart+actualSkipCount:]) | ||
} else { | ||
values = make([]Value, newLength) | ||
copy(values, src.values[:actualStart]) | ||
copy(values[actualStart+itemCount:], src.values[actualStart+actualSkipCount:]) | ||
} |
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.
This code seems to be the same
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.
and arguablt is the same as the code I propose above, so it seems like we do not need all of those ifs.
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.
LGTM!
Sorry for the slow reviews, but this kind of aligned with vacation time and us releasing a new k6 version.
We are currently trying to keep Sobek and goja as close as possible.
Do you want to make a PR to add this to goja as well or do you want me to do it for you?
Ah ... unfortunately me merging some updates from goja made conflicts wiht tc39_test.go - can you please fix them |
OK, I will add this PR to Goja. |
{Array, TypedArray}.prototype.toSorted
#26{Array, TypedArray}.prototype.toReversed
#27{Array, TypedArray}.prototype.with
#28Array.prototype.toSpliced
#29