9a38029537a21963f7989d61cdab5e3796bb8f8c19517a115221b76eff0b1b3b247bce837de7088cbbfa8fe11393ea339a53269e7c1c287d1d700c7fc6c44a 929 B

12345678910111213141516171819
  1. 'use strict';
  2. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  3. var uncurryThis = require('../internals/function-uncurry-this');
  4. var aCallable = require('../internals/a-callable');
  5. var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
  6. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  7. var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
  8. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  9. var sort = uncurryThis(ArrayBufferViewCore.TypedArrayPrototype.sort);
  10. // `%TypedArray%.prototype.toSorted` method
  11. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tosorted
  12. exportTypedArrayMethod('toSorted', function toSorted(compareFn) {
  13. if (compareFn !== undefined) aCallable(compareFn);
  14. var O = aTypedArray(this);
  15. var A = arrayFromConstructorAndList(getTypedArrayConstructor(O), O);
  16. return sort(A, compareFn);
  17. });