Skip to content
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

Closed
wants to merge 6 commits into from

Conversation

shiroyk
Copy link
Contributor

@shiroyk shiroyk commented Jul 30, 2024

{Array, TypedArray}.prototype.toSorted #26
{Array, TypedArray}.prototype.toReversed #27
{Array, TypedArray}.prototype.with #28
Array.prototype.toSpliced #29

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
@shiroyk shiroyk requested a review from a team as a code owner July 30, 2024 08:52
@shiroyk shiroyk requested review from codebien and joanlopez July 30, 2024 08:52
@mstoykov mstoykov requested review from mstoykov and removed request for joanlopez August 6, 2024 11:04
@mstoykov
Copy link
Collaborator

mstoykov commented Aug 6, 2024

Thank you for the PR @shiroyk 🙇 I will try to review it within the week

builtin_array.go Outdated Show resolved Hide resolved
builtin_array.go Outdated Show resolved Hide resolved
builtin_array.go Outdated Show resolved Hide resolved
builtin_arrray_test.go Outdated Show resolved Hide resolved
builtin_array.go Outdated Show resolved Hide resolved
builtin_array.go Outdated
Comment on lines 1360 to 1368
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:])
}
Copy link
Collaborator

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

Copy link
Collaborator

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.

Copy link
Collaborator

@mstoykov mstoykov left a 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?

@mstoykov
Copy link
Collaborator

Ah ... unfortunately me merging some updates from goja made conflicts wiht tc39_test.go - can you please fix them

@shiroyk
Copy link
Contributor Author

shiroyk commented Aug 14, 2024

OK, I will add this PR to Goja.

@mstoykov mstoykov mentioned this pull request Aug 16, 2024
@mstoykov
Copy link
Collaborator

Thank you for all the work @shiroyk 🙇

I merged the upstream changes in #42 and will close this PR

@mstoykov mstoykov closed this Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants