Sha256: b1baca17445f41953e3c16a66e1624ea740a6691e74b12479ca8275bff1c5807

Contents?: true

Size: 806 Bytes

Versions: 243

Compression:

Stored size: 806 Bytes

Contents

'use strict';

var GetIntrinsic = require('get-intrinsic');

var $TypeError = GetIntrinsic('%TypeError%');

var callBound = require('call-bind/callBound');
var $taSome = callBound('TypedArray.prototype.some', true);

var Type = require('./Type');

var isTypedArray = require('is-typed-array');

// https://262.ecma-international.org/6.0/#sec-validatetypedarray

module.exports = function ValidateTypedArray(O) {
	if (Type(O) !== 'Object') {
		throw new $TypeError('Assertion failed: O must be an Object');
	}
	if (!isTypedArray(O)) {
		throw new $TypeError('Assertion failed: O must be a TypedArray');
	}

	// without `.some` (like in node 0.10), there's no way to check buffer detachment, but also no way to be detached
	if ($taSome) {
		$taSome(O, function () { return true; });
	}

	return O.buffer;
};

Version data entries

243 entries across 27 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.32 node_modules/es-abstract/2023/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2019/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2018/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2016/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2020/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2015/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2022/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2017/ValidateTypedArray.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2021/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2023/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2015/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2021/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2018/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2022/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2019/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2016/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2020/ValidateTypedArray.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2017/ValidateTypedArray.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2023/ValidateTypedArray.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2015/ValidateTypedArray.js