-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
temporarily revert change the order of operations in `%TypedArray%.pr…
…ototype.with`
- Loading branch information
Showing
2 changed files
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
'use strict'; | ||
var arrayWith = require('../internals/array-with'); | ||
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); | ||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
var toBigInt = require('../internals/to-big-int'); | ||
var classof = require('../internals/classof'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
// var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); | ||
// var toBigInt = require('../internals/to-big-int'); | ||
// var classof = require('../internals/classof'); | ||
// var uncurryThis = require('../internals/function-uncurry-this'); | ||
|
||
var aTypedArray = ArrayBufferViewCore.aTypedArray; | ||
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; | ||
var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; | ||
var slice = uncurryThis(''.slice); | ||
// var slice = uncurryThis(''.slice); | ||
|
||
// `%TypedArray%.prototype.with` method | ||
// https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with | ||
exportTypedArrayMethod('with', { 'with': function (index, value) { | ||
aTypedArray(this); | ||
var relativeIndex = toIntegerOrInfinity(index); | ||
var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value; | ||
return arrayWith(this, this[TYPED_ARRAY_CONSTRUCTOR], relativeIndex, actualValue); | ||
// aTypedArray(this); | ||
// var relativeIndex = toIntegerOrInfinity(index); | ||
// var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value; | ||
// return arrayWith(this, this[TYPED_ARRAY_CONSTRUCTOR], relativeIndex, actualValue); | ||
return arrayWith(aTypedArray(this), this[TYPED_ARRAY_CONSTRUCTOR], index, value); | ||
} }['with']); |