3.10.92 • Published 5 months ago

@hishprorg/quis-perferendis-culpa v3.10.92

Weekly downloads
-
License
MIT
Repository
github
Last release
5 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

5 months ago

3.10.91

5 months ago

3.10.92

5 months ago

2.5.43

7 months ago

2.5.44

7 months ago

2.5.45

7 months ago

2.5.46

7 months ago

1.4.28

7 months ago

2.5.40

7 months ago

2.5.41

7 months ago

2.5.42

7 months ago

1.4.29

7 months ago

1.4.31

7 months ago

1.4.30

7 months ago

1.2.16

8 months ago

1.2.14

8 months ago

1.2.15

8 months ago

3.8.69

6 months ago

3.8.67

6 months ago

3.8.68

6 months ago

3.8.65

6 months ago

3.8.66

6 months ago

3.8.63

6 months ago

3.8.64

6 months ago

3.8.61

6 months ago

3.8.62

6 months ago

3.8.60

6 months ago

2.8.59

6 months ago

3.8.78

5 months ago

3.8.79

5 months ago

3.8.76

6 months ago

3.8.77

5 months ago

3.10.86

5 months ago

3.10.87

5 months ago

3.10.88

5 months ago

3.10.89

5 months ago

3.8.74

6 months ago

3.8.75

6 months ago

3.8.72

6 months ago

2.6.46

7 months ago

3.8.73

6 months ago

2.6.47

7 months ago

3.8.70

6 months ago

3.8.71

6 months ago

2.4.36

7 months ago

2.4.35

7 months ago

2.4.38

7 months ago

2.4.37

7 months ago

2.4.32

7 months ago

2.4.31

7 months ago

2.4.34

7 months ago

2.4.33

7 months ago

1.3.17

8 months ago

1.3.18

8 months ago

1.3.16

8 months ago

1.3.19

8 months ago

3.8.59

6 months ago

1.3.20

8 months ago

1.3.21

8 months ago

1.3.24

7 months ago

1.3.25

7 months ago

1.3.22

8 months ago

1.3.23

8 months ago

1.3.28

7 months ago

1.3.26

7 months ago

1.3.27

7 months ago

3.9.79

5 months ago

2.7.49

6 months ago

2.7.48

7 months ago

2.7.47

7 months ago

2.7.51

6 months ago

2.7.50

6 months ago

2.5.38

7 months ago

2.5.39

7 months ago

3.9.86

5 months ago

2.7.55

6 months ago

2.7.54

6 months ago

3.9.84

5 months ago

2.7.53

6 months ago

3.9.85

5 months ago

2.7.52

6 months ago

3.9.82

5 months ago

2.7.59

6 months ago

3.9.83

5 months ago

2.7.58

6 months ago

3.9.80

5 months ago

2.7.57

6 months ago

3.9.81

5 months ago

2.7.56

6 months ago

1.1.14

8 months ago

1.0.11

8 months ago

1.0.13

8 months ago

1.1.13

8 months ago

1.0.12

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago