UNPKG

898 BJavaScriptView Raw
1'use strict';
2/* eslint-disable no-new -- required for testing */
3var global = require('../internals/global');
4var fails = require('../internals/fails');
5var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
6var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS;
7
8var ArrayBuffer = global.ArrayBuffer;
9var Int8Array = global.Int8Array;
10
11module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () {
12 Int8Array(1);
13}) || !fails(function () {
14 new Int8Array(-1);
15}) || !checkCorrectnessOfIteration(function (iterable) {
16 new Int8Array();
17 new Int8Array(null);
18 new Int8Array(1.5);
19 new Int8Array(iterable);
20}, true) || fails(function () {
21 // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
22 return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
23});