Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-typed-array

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-typed-array - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

4

CHANGELOG.md

@@ -0,1 +1,5 @@

1.1.3 / 2020-01-24
=================
* [Refactor] use `es-abstract`’s `callBound`, `available-typed-arrays`, `has-symbols`
1.1.2 / 2020-01-20

@@ -2,0 +6,0 @@ =================

61

index.js
'use strict';
var forEach = require('foreach');
var availableTypedArrays = require('available-typed-arrays');
var callBound = require('es-abstract/helpers/callBound');
var toStr = Object.prototype.toString;
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
var $toString = callBound('Object.prototype.toString');
var hasSymbols = require('has-symbols')();
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
var typedArrays = [
'Float32Array',
'Float64Array',
'Int8Array',
'Int16Array',
'Int32Array',
'Uint8Array',
'Uint8ClampedArray',
'Uint16Array',
'Uint32Array',
'BigInt64Array',
'BigUint64Array'
];
var typedArrays = availableTypedArrays();
var $indexOf = Array.prototype.indexOf || function indexOf(value) {
/* eslint no-invalid-this: 0 */
for (var i = 0; i < this.length; i += 1) {
if (this[i] === value) {
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
for (var i = 0; i < array.length; i += 1) {
if (array[i] === value) {
return i;

@@ -31,20 +21,19 @@ }

};
var $slice = String.prototype.slice;
var $slice = callBound('String.prototype.slice');
var toStrTags = {};
var gOPD = Object.getOwnPropertyDescriptor;
if (hasToStringTag && gOPD && Object.getPrototypeOf) {
var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');
var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
if (hasToStringTag && gOPD && getPrototypeOf) {
forEach(typedArrays, function (typedArray) {
if (typeof global[typedArray] === 'function') {
var arr = new global[typedArray]();
if (!(Symbol.toStringTag in arr)) {
throw new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.');
}
var proto = Object.getPrototypeOf(arr);
var descriptor = gOPD(proto, Symbol.toStringTag);
if (!descriptor) {
var superProto = Object.getPrototypeOf(proto);
descriptor = gOPD(superProto, Symbol.toStringTag);
}
toStrTags[typedArray] = descriptor.get;
var arr = new global[typedArray]();
if (!(Symbol.toStringTag in arr)) {
throw new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.');
}
var proto = getPrototypeOf(arr);
var descriptor = gOPD(proto, Symbol.toStringTag);
if (!descriptor) {
var superProto = getPrototypeOf(proto);
descriptor = gOPD(superProto, Symbol.toStringTag);
}
toStrTags[typedArray] = descriptor.get;
});

@@ -68,4 +57,4 @@ }

if (!hasToStringTag) {
var tag = $slice.call(toStr.call(value), 8, -1);
return $indexOf.call(typedArrays, tag) > -1;
var tag = $slice($toString(value), 8, -1);
return $indexOf(typedArrays, tag) > -1;
}

@@ -72,0 +61,0 @@ if (!gOPD) { return false; }

{
"name": "is-typed-array",
"version": "1.1.2",
"version": "1.1.3",
"author": {

@@ -57,3 +57,6 @@ "name": "Jordan Harband",

"dependencies": {
"foreach": "^2.0.5"
"available-typed-arrays": "^1.0.0",
"es-abstract": "^1.17.4",
"foreach": "^2.0.5",
"has-symbols": "^1.0.1"
},

@@ -60,0 +63,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc