main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var $TypeError = require('es-errors/type');
|
---|
4 |
|
---|
5 | var IsTypedArrayOutOfBounds = require('./IsTypedArrayOutOfBounds');
|
---|
6 | var IsViewOutOfBounds = require('./IsViewOutOfBounds');
|
---|
7 | var MakeDataViewWithBufferWitnessRecord = require('./MakeDataViewWithBufferWitnessRecord');
|
---|
8 | var MakeTypedArrayWithBufferWitnessRecord = require('./MakeTypedArrayWithBufferWitnessRecord');
|
---|
9 |
|
---|
10 | var isDataView = require('is-data-view');
|
---|
11 | var isTypedArray = require('is-typed-array');
|
---|
12 |
|
---|
13 | // https://262.ecma-international.org/15.0/#sec-isarraybufferviewoutofbounds
|
---|
14 |
|
---|
15 | module.exports = function IsArrayBufferViewOutOfBounds(O) {
|
---|
16 | var isDV = isDataView(O);
|
---|
17 | if (!isTypedArray(O) && !isDV) {
|
---|
18 | throw new $TypeError('Assertion failed: `O` must be a TypedArray or DataView');
|
---|
19 | }
|
---|
20 |
|
---|
21 | if (isDV) { // step 1
|
---|
22 | var viewRecord = MakeDataViewWithBufferWitnessRecord(O, 'SEQ-CST'); // step 1.a
|
---|
23 |
|
---|
24 | return IsViewOutOfBounds(viewRecord); // step 1.b
|
---|
25 | }
|
---|
26 |
|
---|
27 | var taRecord = MakeTypedArrayWithBufferWitnessRecord(O, 'SEQ-CST'); // step 2
|
---|
28 |
|
---|
29 | return IsTypedArrayOutOfBounds(taRecord); // step 3
|
---|
30 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.