3.10.92 • Published 4 months ago

@hishprorg/quis-perferendis-culpa v3.10.92

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@hishprorg/quis-perferendis-culpa Version Badge

github actions coverage License Downloads

npm badge

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.

Example

var typedArrayByteOffset = require('@hishprorg/quis-perferendis-culpa');
var assert = require('assert');

assert.equal(false, typedArrayByteOffset(undefined));
assert.equal(false, typedArrayByteOffset(null));
assert.equal(false, typedArrayByteOffset(false));
assert.equal(false, typedArrayByteOffset(true));
assert.equal(false, typedArrayByteOffset([]));
assert.equal(false, typedArrayByteOffset({}));
assert.equal(false, typedArrayByteOffset(/a/g));
assert.equal(false, typedArrayByteOffset(new RegExp('a', 'g')));
assert.equal(false, typedArrayByteOffset(new Date()));
assert.equal(false, typedArrayByteOffset(42));
assert.equal(false, typedArrayByteOffset(NaN));
assert.equal(false, typedArrayByteOffset(Infinity));
assert.equal(false, typedArrayByteOffset(new Number(42)));
assert.equal(false, typedArrayByteOffset('foo'));
assert.equal(false, typedArrayByteOffset(Object('foo')));
assert.equal(false, typedArrayByteOffset(function () {}));
assert.equal(false, typedArrayByteOffset(function* () {}));
assert.equal(false, typedArrayByteOffset(x => x * x));
assert.equal(false, typedArrayByteOffset([]));

const buffer = new ArrayBuffer(32);

assert.equal(8, typedArrayByteOffset(new Int8Array(buffer, 8)));
assert.equal(8, typedArrayByteOffset(new Uint8Array(buffer, 8)));
assert.equal(8, typedArrayByteOffset(new Uint8ClampedArray(buffer, 8)));
assert.equal(4, typedArrayByteOffset(new Int16Array(buffer, 4)));
assert.equal(4, typedArrayByteOffset(new Uint16Array(buffer, 4)));
assert.equal(8, typedArrayByteOffset(new Int32Array(buffer, 8)));
assert.equal(8, typedArrayByteOffset(new Uint32Array(buffer, 8)));
assert.equal(16, typedArrayByteOffset(new Float32Array(buffer, 16)));
assert.equal(16, typedArrayByteOffset(new Float64Array(buffer, 16)));
assert.equal(16, typedArrayByteOffset(new BigInt64Array(buffer, 16)));
assert.equal(16, typedArrayByteOffset(new BigUint64Array(buffer, 16)));

Tests

Simply clone the repo, npm install, and run npm test

@hishprorg/ipsa-consectetur-minima@hishprorg/nemo-blanditiis@hishprorg/neque-laborum-vel@hishprorg/quis-quibusdam@hishprorg/quibusdam-dolores@hishprorg/quis-doloribus@hishprorg/quidem-delectus@hishprorg/quidem-et@hishprorg/quis-est@hishprorg/sed-nihil-iusto@hishprorg/sequi-inventore-labore@hishprorg/sed-sunt@hishprorg/temporibus-aliquam-neque@hishprorg/tempore-dolor-ut@hishprorg/accusantium-architecto@hishprorg/ad-labore-dolor@hishprorg/ad-minima@hishprorg/ad-soluta-et@hishprorg/accusantium-consectetur-incidunt@hishprorg/beatae-cumque@hishprorg/beatae-animi-commodi@hishprorg/autem-quo@hishprorg/debitis-quaerat@hishprorg/debitis-qui@hishprorg/cupiditate-ut@hishprorg/dolores-ut@hishprorg/et-esse-quasi@hishprorg/est-odio-laudantium@hishprorg/eum-eos@hishprorg/et-dicta-cum@hishprorg/eum-nihil-maiores@hishprorg/illo-voluptas@hishprorg/impedit-consectetur-dicta@hishprorg/architecto-sequi@hishprorg/architecto-sapiente@hishprorg/asperiores-hic@hishprorg/aspernatur-consequatur@hishprorg/asperiores-voluptates@hishprorg/asperiores-provident@hishprorg/consectetur-sunt@hishprorg/consectetur-ab@hishprorg/consectetur-dolores@hishprorg/deserunt-est@hishprorg/deserunt-velit-quod@hishprorg/deserunt-nihil@hishprorg/deserunt-deleniti@hishprorg/doloremque-soluta@hishprorg/doloremque-mollitia@hishprorg/dolore-suscipit@hishprorg/hic-omnis@hishprorg/hic-perferendis@hishprorg/fuga-repellat@hishprorg/fugiat-accusamus-laboriosam@hishprorg/fugiat-eius@hishprorg/fugiat-libero-itaque@hishprorg/aliquam-quibusdam-repudiandae@hishprorg/aliquid-delectus-nisi@hishprorg/aliquid-ut-debitis@hishprorg/alias-maiores-saepe@hishprorg/amet-qui@hishprorg/beatae-officia@hishprorg/earum-occaecati@hishprorg/earum-sint-veritatis@hishprorg/earum-inventore@hishprorg/earum-consectetur@hishprorg/est-dicta-quis@hishprorg/esse-voluptates-veritatis@hishprorg/id-ab@hishprorg/id-harum@hishprorg/id-modi@hishprorg/id-dignissimos@hishprorg/id-voluptas@hishprorg/id-consequuntur@hishprorg/hic-repellendus-hic@hishprorg/illo-dolores@hishprorg/cumque-optio@hishprorg/cupiditate-quaerat-qui@hishprorg/doloribus-vero@hishprorg/dolorum-commodi-architecto@hishprorg/doloribus-reiciendis@hishprorg/doloribus-minima@hishprorg/dolorum-est@hishprorg/exercitationem-ipsum@hishprorg/distinctio-repudiandae-molestias@hishprorg/distinctio-alias@hishprorg/dignissimos-sunt-quaerat@hishprorg/distinctio-in@hishprorg/eos-enim-voluptate@hishprorg/eos-asperiores@hishprorg/eligendi-laborum@hishprorg/enim-fugiat-quas@hishprorg/eligendi-neque@hishprorg/eveniet-maxime@hishprorg/ex-tempora-libero@hishprorg/architecto-consectetur@hishprorg/culpa-ea-facilis@hishprorg/culpa-ratione-dolores@hishprorg/corrupti-voluptas@hishprorg/corrupti-vero@hishprorg/culpa-iusto-corrupti
3.10.90

4 months ago

3.10.91

4 months ago

3.10.92

4 months ago

2.5.43

6 months ago

2.5.44

6 months ago

2.5.45

6 months ago

2.5.46

6 months ago

1.4.28

6 months ago

2.5.40

6 months ago

2.5.41

6 months ago

2.5.42

6 months ago

1.4.29

6 months ago

1.4.31

6 months ago

1.4.30

6 months ago

1.2.16

7 months ago

1.2.14

7 months ago

1.2.15

7 months ago

3.8.69

5 months ago

3.8.67

5 months ago

3.8.68

5 months ago

3.8.65

5 months ago

3.8.66

5 months ago

3.8.63

5 months ago

3.8.64

5 months ago

3.8.61

5 months ago

3.8.62

5 months ago

3.8.60

5 months ago

2.8.59

5 months ago

3.8.78

4 months ago

3.8.79

4 months ago

3.8.76

4 months ago

3.8.77

4 months ago

3.10.86

4 months ago

3.10.87

4 months ago

3.10.88

4 months ago

3.10.89

4 months ago

3.8.74

5 months ago

3.8.75

5 months ago

3.8.72

5 months ago

2.6.46

6 months ago

3.8.73

5 months ago

2.6.47

6 months ago

3.8.70

5 months ago

3.8.71

5 months ago

2.4.36

6 months ago

2.4.35

6 months ago

2.4.38

6 months ago

2.4.37

6 months ago

2.4.32

6 months ago

2.4.31

6 months ago

2.4.34

6 months ago

2.4.33

6 months ago

1.3.17

7 months ago

1.3.18

7 months ago

1.3.16

7 months ago

1.3.19

7 months ago

3.8.59

5 months ago

1.3.20

7 months ago

1.3.21

7 months ago

1.3.24

6 months ago

1.3.25

6 months ago

1.3.22

7 months ago

1.3.23

6 months ago

1.3.28

6 months ago

1.3.26

6 months ago

1.3.27

6 months ago

3.9.79

4 months ago

2.7.49

5 months ago

2.7.48

5 months ago

2.7.47

6 months ago

2.7.51

5 months ago

2.7.50

5 months ago

2.5.38

6 months ago

2.5.39

6 months ago

3.9.86

4 months ago

2.7.55

5 months ago

2.7.54

5 months ago

3.9.84

4 months ago

2.7.53

5 months ago

3.9.85

4 months ago

2.7.52

5 months ago

3.9.82

4 months ago

2.7.59

5 months ago

3.9.83

4 months ago

2.7.58

5 months ago

3.9.80

4 months ago

2.7.57

5 months ago

3.9.81

4 months ago

2.7.56

5 months ago

1.1.14

7 months ago

1.0.11

7 months ago

1.0.13

7 months ago

1.1.13

7 months ago

1.0.12

7 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago