![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
which-typed-array
Advanced tools
Package description
The `which-typed-array` npm package is designed to identify the type of a given typed array instance. It supports all built-in JavaScript typed array types, including `Int8Array`, `Uint8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`, `Float64Array`, and `BigInt64Array`, `BigUint64Array`. This package is useful for applications that need to process or manipulate typed arrays and must determine their specific types to apply the correct operations.
Identifying Typed Array Type
This feature allows the identification of the type of a typed array. The function `whichTypedArray` is called with a typed array as its argument, and it returns a string representing the type of the typed array.
"use strict";\nconst whichTypedArray = require('which-typed-array');\nconsole.log(whichTypedArray(new Uint8Array())); // 'Uint8Array'\nconsole.log(whichTypedArray(new Float32Array())); // 'Float32Array'"
The `is-typedarray` package is similar to `which-typed-array` in that it is used to check if a given object is a typed array. However, unlike `which-typed-array`, it does not specify the type of the typed array; it only checks if the object is a typed array or not.
The `typedarray-detection` package offers functionality similar to `which-typed-array` by allowing the detection of typed array types. It provides a more extensive set of utilities for working with typed arrays, including functions to check for specific types of typed arrays, but it might not be as straightforward or focused as `which-typed-array` for simply identifying the typed array type.
Changelog
v1.1.0 - 2019-02-16
jscs
381c9b4
node
v8.2
, v7.10
, v6.11
, v5.8
; improve matrix; newer npm breaks on older node 7015c19
node
v10.0
, v9.11
, v8.11
, v6.14
, v4.9
; use nvm install-latest-npm
ad67885
node
v11.6
, v10.15
, v8.15
, v6.16
dd94bfb
de98bc1
test.html
06cfb1b
node
v7.0
, v6.9
, v4.6
; improve test matrix df76eaa
BigInt64Array
and BigUint64Array
d6bca3a
jscs
, nsp
, eslint
f23b45b
@ljharb/eslint-config
, eslint
, semver
, tape
ddb4484
eslint
, @ljharb/eslint-config
, covert
, is-callable
, replace
, semver
, tape
4524e59
tape
, jscs
, nsp
, eslint
, @ljharb/eslint-config
, semver
1ec7056
jscs
, nsp
, eslint
, @ljharb/eslint-config
799487d
tape
, jscs
, nsp
, eslint
, @ljharb/eslint-config
, semver
8092598
node
v11.10
a5aabb1
@ljharb/eslint-config
, eslint
, nsp
, semver
, tape
277be33
npm audit
instead of nsp
ee97dc7
tape
, eslint
, @ljharb/eslint-config
262ffb0
jscs
, eslint
, @ljharb/eslint-config
d6bbcfc
node
v6.2
2ff89eb
e2bc271
nsp
, eslint
, @ljharb/eslint-config
b79e93b
nsp
, eslint
, @ljharb/eslint-config
016dbff
eslint
, tape
6ce4bbc
node
v10.1
f0683a0
node
v7.2
2f29cef
replace
73b5ba6
function-bind
c8a18c2
node
v5.12
812102b
node
v5.10
271584f
Readme
Which kind of Typed Array is this JavaScript value? Works cross-realm, without instanceof
, and despite Symbol.toStringTag.
var whichTypedArray = require('which-typed-array');
var assert = require('assert');
assert.equal(false, whichTypedArray(undefined));
assert.equal(false, whichTypedArray(null));
assert.equal(false, whichTypedArray(false));
assert.equal(false, whichTypedArray(true));
assert.equal(false, whichTypedArray([]));
assert.equal(false, whichTypedArray({}));
assert.equal(false, whichTypedArray(/a/g));
assert.equal(false, whichTypedArray(new RegExp('a', 'g')));
assert.equal(false, whichTypedArray(new Date()));
assert.equal(false, whichTypedArray(42));
assert.equal(false, whichTypedArray(NaN));
assert.equal(false, whichTypedArray(Infinity));
assert.equal(false, whichTypedArray(new Number(42)));
assert.equal(false, whichTypedArray('foo'));
assert.equal(false, whichTypedArray(Object('foo')));
assert.equal(false, whichTypedArray(function () {}));
assert.equal(false, whichTypedArray(function* () {}));
assert.equal(false, whichTypedArray(x => x * x));
assert.equal(false, whichTypedArray([]));
assert.equal('Int8Array', whichTypedArray(new Int8Array()));
assert.equal('Uint8Array', whichTypedArray(new Uint8Array()));
assert.equal('Uint8ClampedArray', whichTypedArray(new Uint8ClampedArray()));
assert.equal('Int16Array', whichTypedArray(new Int16Array()));
assert.equal('Uint16Array', whichTypedArray(new Uint16Array()));
assert.equal('Int32Array', whichTypedArray(new Int32Array()));
assert.equal('Uint32Array', whichTypedArray(new Uint32Array()));
assert.equal('Float32Array', whichTypedArray(new Float32Array()));
assert.equal('Float64Array', whichTypedArray(new Float64Array()));
Simply clone the repo, npm install
, and run npm test
FAQs
Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.
The npm package which-typed-array receives a total of 33,924,444 weekly downloads. As such, which-typed-array popularity was classified as popular.
We found that which-typed-array demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.