You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The interpretation and use of the arguments of this method are the same as for `Array.prototype.filter` as defined in <emu-xref href="#sec-array.prototype.filter"></emu-xref>.</p>
343
+
<p>This method performs the following steps when called:</p>
344
+
<emu-alg>
345
+
1. Let _O_ be the *this* value.
346
+
1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~).
347
+
1. Let _len_ be TypedArrayLength(_taRecord_).
348
+
1. If IsCallable(_callback_) is *false*, throw a *TypeError* exception.
349
+
1. Let _kept_ be a new empty List.
350
+
1. Let _captured_ be 0.
351
+
1. Let _k_ be 0.
352
+
1. Repeat, while _k_ < _len_,
353
+
1. Let _Pk_ be ! ToString(𝔽(_k_)).
354
+
1. Let _kValue_ be ! Get(_O_, _Pk_).
355
+
1. Let _selected_ be ToBoolean(? Call(_callback_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)).
356
+
1. If _selected_ is *true*, then
357
+
1. Append _kValue_ to _kept_.
358
+
1. Set _captured_ to _captured_ + 1.
359
+
1. Set _k_ to _k_ + 1.
360
+
1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_captured_) »<ins>, ~write~</ins>).
361
+
1. <ins>Assert: IsImmutableBuffer(_A_.[[ViewedArrayBuffer]]) is *false*.</ins>
<p>The interpretation and use of the arguments of this method are the same as for `Array.prototype.map` as defined in <emu-xref href="#sec-array.prototype.map"></emu-xref>.</p>
374
+
<p>This method performs the following steps when called:</p>
375
+
<emu-alg>
376
+
1. Let _O_ be the *this* value.
377
+
1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~).
378
+
1. Let _len_ be TypedArrayLength(_taRecord_).
379
+
1. If IsCallable(_callback_) is *false*, throw a *TypeError* exception.
380
+
1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_len_) »<ins>, ~write~</ins>).
381
+
1. <ins>Assert: IsImmutableBuffer(_A_.[[ViewedArrayBuffer]]) is *false*.</ins>
382
+
1. Let _k_ be 0.
383
+
1. Repeat, while _k_ < _len_,
384
+
1. Let _Pk_ be ! ToString(𝔽(_k_)).
385
+
1. Let _kValue_ be ! Get(_O_, _Pk_).
386
+
1. Let _mappedValue_ be ? Call(_callback_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »).
<p>The interpretation and use of the arguments of this method are the same as for `Array.prototype.reverse` as defined in <emu-xref href="#sec-array.prototype.reverse"></emu-xref>.</p>
@@ -307,6 +436,60 @@ contributors: Mark S. Miller, Richard Gibson
307
436
<p>This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.</p>
<p>The interpretation and use of the arguments of this method are the same as for `Array.prototype.slice` as defined in <emu-xref href="#sec-array.prototype.slice"></emu-xref>.</p>
442
+
<p>This method performs the following steps when called:</p>
443
+
<emu-alg>
444
+
1. Let _O_ be the *this* value.
445
+
1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~).
446
+
1. Let _srcArrayLength_ be TypedArrayLength(_taRecord_).
447
+
1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_).
448
+
1. If _relativeStart_ = -∞, let _startIndex_ be 0.
449
+
1. Else if _relativeStart_ < 0, let _startIndex_ be max(_srcArrayLength_ + _relativeStart_, 0).
450
+
1. Else, let _startIndex_ be min(_relativeStart_, _srcArrayLength_).
451
+
1. If _end_ is *undefined*, let _relativeEnd_ be _srcArrayLength_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_).
452
+
1. If _relativeEnd_ = -∞, let _endIndex_ be 0.
453
+
1. Else if _relativeEnd_ < 0, let _endIndex_ be max(_srcArrayLength_ + _relativeEnd_, 0).
454
+
1. Else, let _endIndex_ be min(_relativeEnd_, _srcArrayLength_).
455
+
1. Let _countBytes_ be max(_endIndex_ - _startIndex_, 0).
456
+
1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_countBytes_) »<ins>, ~write~</ins>).
457
+
1. <ins>Assert: IsImmutableBuffer(_A_.[[ViewedArrayBuffer]]) is *false*.</ins>
458
+
1. If _countBytes_ > 0, then
459
+
1. Set _taRecord_ to MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~).
460
+
1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception.
461
+
1. Set _endIndex_ to min(_endIndex_, TypedArrayLength(_taRecord_)).
462
+
1. Set _countBytes_ to max(_endIndex_ - _startIndex_, 0).
463
+
1. Let _srcType_ be TypedArrayElementType(_O_).
464
+
1. Let _targetType_ be TypedArrayElementType(_A_).
465
+
1. If _srcType_ is _targetType_, then
466
+
1. NOTE: The transfer must be performed in a manner that preserves the bit-level encoding of the source data.
467
+
1. Let _srcBuffer_ be _O_.[[ViewedArrayBuffer]].
468
+
1. Let _targetBuffer_ be _A_.[[ViewedArrayBuffer]].
469
+
1. Let _elementSize_ be TypedArrayElementSize(_O_).
470
+
1. Let _srcByteOffset_ be _O_.[[ByteOffset]].
471
+
1. Let _srcByteIndex_ be (_startIndex_ × _elementSize_) + _srcByteOffset_.
472
+
1. Let _targetByteIndex_ be _A_.[[ByteOffset]].
473
+
1. Let _endByteIndex_ be _targetByteIndex_ + (_countBytes_ × _elementSize_).
474
+
1. Repeat, while _targetByteIndex_ < _endByteIndex_,
475
+
1. Let _value_ be GetValueFromBuffer(_srcBuffer_, _srcByteIndex_, ~uint8~, *true*, ~unordered~).
<p>This is a distinct method that, except as described below, implements the same requirements as those of `Array.prototype.sort` as defined in <emu-xref href="#sec-array.prototype.sort"></emu-xref>. The implementation of this method may be optimized with the knowledge that the *this* value is an object that has a fixed length and whose integer-indexed properties are not sparse.</p>
@@ -336,6 +519,54 @@ contributors: Mark S. Miller, Richard Gibson
_argumentList_: a List of ECMAScript language values,
527
+
<ins>optional _accessMode_: ~read~ or ~write~,</ins>
528
+
): either a normal completion containing a TypedArray or a throw completion
529
+
</h1>
530
+
<dl class="header">
531
+
<dt>description</dt>
532
+
<dd>It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. Unlike ArraySpeciesCreate, which can create non-Array objects through the use of %Symbol.species%, this operation enforces that the constructor function creates an actual TypedArray.</dd>
533
+
</dl>
534
+
<emu-alg>
535
+
1. <ins>If _accessMode_ is not present, set _accessMode_ to ~read~.</ins>
536
+
1. Let _defaultConstructor_ be the intrinsic object associated with the constructor name _exemplar_.[[TypedArrayName]] in <emu-xref href="#table-the-typedarray-constructors"></emu-xref>.
537
+
1. Let _constructor_ be ? SpeciesConstructor(_exemplar_, _defaultConstructor_).
538
+
1. Let _result_ be ? TypedArrayCreateFromConstructor(_constructor_, _argumentList_<ins>, _accessMode_</ins>).
539
+
1. <del>Assert: _result_ has [[TypedArrayName]] and [[ContentType]] internal slots.</del>
540
+
1. <ins>Assert: _result_ has all of the internal slots of a <var>TypedArray</var> instance (<emu-xref href="#sec-properties-of-typedarray-instances"></emu-xref>).</ins>
541
+
1. If _result_.[[ContentType]] is not _exemplar_.[[ContentType]], throw a *TypeError* exception.
0 commit comments