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.0.4 to 1.1.0

.editorconfig

11

CHANGELOG.md

@@ -0,1 +1,12 @@

1.1.0 / 2019-02-16
=================
* [New] add `BigInt64Array` and `BigUint64Array`
* [Refactor] use an array instead of an object for storing Typed Array names
* [meta] ignore `test.html`
* [Tests] up to `node` `v11.10`, `v10.15`, `v8.15`, `v7.10`, `v6.16`, `v5.10`, `v4.9`
* [Tests] remove `jscs`
* [Tests] use `npm audit` instead of `nsp`
* [Dev Deps] update `eslint`,` @ljharb/eslint-config`, `is-callable`, `tape`, `replace`, `semver`
* [Dev Deps] remove unused eccheck script + dep
1.0.4 / 2016-03-19

@@ -2,0 +13,0 @@ =================

52

index.js

@@ -8,13 +8,15 @@ 'use strict';

var typedArrays = {
Float32Array: true,
Float64Array: true,
Int8Array: true,
Int16Array: true,
Int32Array: true,
Uint8Array: true,
Uint8ClampedArray: true,
Uint16Array: true,
Uint32Array: true
};
var typedArrays = [
'Float32Array',
'Float64Array',
'Int8Array',
'Int16Array',
'Int32Array',
'Uint8Array',
'Uint8ClampedArray',
'Uint16Array',
'Uint32Array',
'BigInt64Array',
'BigUint64Array'
];

@@ -25,18 +27,20 @@ var slice = String.prototype.slice;

if (hasToStringTag && gOPD && Object.getPrototypeOf) {
forEach(typedArrays, function (_, typedArray) {
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.');
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 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 tryTypedArrays = function tryTypedArrays(value) {
var tryTypedArrays = function tryAllTypedArrays(value) {
var anyTrue = false;

@@ -55,5 +59,5 @@ forEach(toStrTags, function (getter, typedArray) {

if (!value || typeof value !== 'object') { return false; }
if (!hasToStringTag) { return !!typedArrays[slice.call(toStr.call(value), 8, -1)]; }
if (!hasToStringTag) { return typedArrays.indexOf(slice.call(toStr.call(value), 8, -1)) > -1; }
if (!gOPD) { return false; }
return tryTypedArrays(value);
};
{
"name": "is-typed-array",
"version": "1.0.4",
"version": "1.1.0",
"author": {

@@ -23,10 +23,9 @@ "name": "Jordan Harband",

"tests-only": "node --es-staging test.js",
"posttest": "npm run --silent security",
"posttest": "npm run audit",
"coverage": "covert test.js",
"coverage-quiet": "covert test.js --quiet",
"lint": "npm run --silent jscs && npm run --silent eslint",
"jscs": "jscs *.js",
"eslint": "eslint *.js",
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"security": "nsp check"
"lint": "eslint .",
"preaudit": "npm install --package-lock --package-lock-only",
"audit": "npm audit",
"postaudit": "rm package-lock.json"
},

@@ -61,14 +60,11 @@ "repository": {

"devDependencies": {
"tape": "^4.5.1",
"covert": "^1.1.0",
"jscs": "^2.11.0",
"editorconfig-tools": "^0.1.1",
"nsp": "^2.2.1",
"eslint": "^2.4.0",
"@ljharb/eslint-config": "^2.1.1",
"@ljharb/eslint-config": "^13.1.1",
"covert": "^1.1.1",
"eslint": "^5.14.0",
"is-callable": "^1.1.4",
"make-arrow-function": "^1.1.0",
"make-generator-function": "^1.1.0",
"semver": "^5.1.0",
"replace": "^0.3.0",
"is-callable": "^1.1.3"
"replace": "^1.0.1",
"semver": "^5.6.0",
"tape": "^4.10.1"
},

@@ -97,2 +93,1 @@ "testling": {

}

@@ -6,3 +6,3 @@ 'use strict';

var isCallable = require('is-callable');
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
var genFn = require('make-generator-function');

@@ -21,3 +21,5 @@ var arrowFn = require('make-arrow-function')();

'Float32Array',
'Float64Array'
'Float64Array',
'BigInt64Array',
'BigUint64Array'
];

@@ -72,7 +74,10 @@

test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) {
t.plan(typedArrayNames.length);
forEach(typedArrayNames, function (typedArray) {
var fakeTypedArray = [];
fakeTypedArray[Symbol.toStringTag] = typedArray;
t.notOk(isTypedArray(fakeTypedArray), 'faked ' + typedArray + ' is not typed array');
if (typeof global[typedArray] === 'function') {
var fakeTypedArray = [];
fakeTypedArray[Symbol.toStringTag] = typedArray;
t.notOk(isTypedArray(fakeTypedArray), 'faked ' + typedArray + ' is not typed array');
} else {
t.comment('# SKIP ' + typedArray + ' is not supported');
}
});

@@ -89,3 +94,3 @@ t.end();

} else {
t.comment(typedArray + ' is not supported');
t.comment('# SKIP ' + typedArray + ' is not supported');
}

@@ -92,0 +97,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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