graaljs icon indicating copy to clipboard operation
graaljs copied to clipboard

Implementation of Proposal tc39/proposal-change-array-by-copy

Open mschlaegl opened this issue 2 years ago • 1 comments

Experimental implementation of tc39/proposal-change-array-by-copy: Provides additional methods on Array.prototype and TypedArray.prototype to enable changes on the array by returning a new copy of it with the change.

Implemented:

  • Array.prototype.toReversed() -> Array
  • Array.prototype.toSorted(compareFn) -> Array .. TODO: Generalization necessary: see specification: sort, SortIndexedProperties, CompareArrayElements, ...)
  • Array.prototype.toSpliced(start, deleteCount, ...items) -> Array .. TODO: Optimizations possible.
  • Array.prototype.with(index, value) -> Array
  • TypedArray.prototype.toReversed() -> TypedArray .. TODO: Additional work is required to meet the specification.
  • TypedArray.prototype.toSorted(compareFn) -> TypedArray .. TODO: Additional work is required to meet the specification.
  • TypedArray.prototype.with(index, value) -> TypedArray .. TODO: Additional work is required to meet the specification.

mschlaegl avatar Sep 04 '22 19:09 mschlaegl

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA). The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When singing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

(Parts of) this code has been merged in the PR https://github.com/oracle/graaljs/commit/6e1fb8b91fea8a969b1033e908a3d380a0b97a76

You can see your contribution on https://github.com/oracle/graaljs/pulse as well.

wirthi avatar Feb 21 '23 11:02 wirthi