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

Add Change Array by Copy methods #6670

Open
Samathingamajig opened this issue Apr 6, 2023 · 0 comments
Open

Add Change Array by Copy methods #6670

Samathingamajig opened this issue Apr 6, 2023 · 0 comments

Comments

@Samathingamajig
Copy link

"Change Array by Copy" is a stage 4 proposal, which means it's ready to come out in the next edition of the ECMAScript standard and is in the current draft. It brings along four new methods for Array.prototype:

  • Array.prototype.toReversed() -> Array, returns a reversed version of a shallow copy of the array, leaving the original array intact
  • Array.prototype.toSorted(compareFn) -> Array, returns a sorted version of a shallow copy of the array, leaving the original array intact
  • Array.prototype.toSpliced(start, deleteCount, ...items) -> Array, returns a spliced version of a shallow copy of the array, leaving the original array intact
  • Array.prototype.with(index, value) -> Array, returns a version of a shallow copy of the array, modified at the specific index, leaving the original array intact

as well as three new methods for TypedArray.prototype:

  • TypedArray.prototype.toReversed() -> TypedArray, see above
  • TypedArray.prototype.toSorted(compareFn) -> TypedArray, see above
  • TypedArray.prototype.with(index, value) -> TypedArray, see above

According to their README.md, it has the following implementations

@Samathingamajig Samathingamajig changed the title Add Add Change Array by Copy methods Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants