Gathering detailed insights and metrics for typed-array-byte-offset
Gathering detailed insights and metrics for typed-array-byte-offset
Gathering detailed insights and metrics for typed-array-byte-offset
Gathering detailed insights and metrics for typed-array-byte-offset
npm install typed-array-byte-offset
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
5 Stars
32 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Dec 19, 2024
Latest Version
1.0.4
Package Id
typed-array-byte-offset@1.0.4
Unpacked Size
19.29 kB
Size
6.48 kB
File Count
11
NPM Version
10.9.2
Node Version
23.4.0
Published on
Dec 19, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
7
26
Robustly get the byte offset of a Typed Array, or false
if it is not a Typed Array. Works cross-realm, in every engine, even if the byteOffset
property is overridden.
1var typedArrayByteOffset = require('typed-array-byte-offset');
2var assert = require('assert');
3
4assert.equal(false, typedArrayByteOffset(undefined));
5assert.equal(false, typedArrayByteOffset(null));
6assert.equal(false, typedArrayByteOffset(false));
7assert.equal(false, typedArrayByteOffset(true));
8assert.equal(false, typedArrayByteOffset([]));
9assert.equal(false, typedArrayByteOffset({}));
10assert.equal(false, typedArrayByteOffset(/a/g));
11assert.equal(false, typedArrayByteOffset(new RegExp('a', 'g')));
12assert.equal(false, typedArrayByteOffset(new Date()));
13assert.equal(false, typedArrayByteOffset(42));
14assert.equal(false, typedArrayByteOffset(NaN));
15assert.equal(false, typedArrayByteOffset(Infinity));
16assert.equal(false, typedArrayByteOffset(new Number(42)));
17assert.equal(false, typedArrayByteOffset('foo'));
18assert.equal(false, typedArrayByteOffset(Object('foo')));
19assert.equal(false, typedArrayByteOffset(function () {}));
20assert.equal(false, typedArrayByteOffset(function* () {}));
21assert.equal(false, typedArrayByteOffset(x => x * x));
22assert.equal(false, typedArrayByteOffset([]));
23
24const buffer = new ArrayBuffer(32);
25
26assert.equal(8, typedArrayByteOffset(new Int8Array(buffer, 8)));
27assert.equal(8, typedArrayByteOffset(new Uint8Array(buffer, 8)));
28assert.equal(8, typedArrayByteOffset(new Uint8ClampedArray(buffer, 8)));
29assert.equal(4, typedArrayByteOffset(new Int16Array(buffer, 4)));
30assert.equal(4, typedArrayByteOffset(new Uint16Array(buffer, 4)));
31assert.equal(8, typedArrayByteOffset(new Int32Array(buffer, 8)));
32assert.equal(8, typedArrayByteOffset(new Uint32Array(buffer, 8)));
33assert.equal(16, typedArrayByteOffset(new Float32Array(buffer, 16)));
34assert.equal(16, typedArrayByteOffset(new Float64Array(buffer, 16)));
35assert.equal(16, typedArrayByteOffset(new BigInt64Array(buffer, 16)));
36assert.equal(16, typedArrayByteOffset(new BigUint64Array(buffer, 16)));
Simply clone the repo, npm install
, and run npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More