3.4.90 • Published 10 months ago

@erboladaiorg/voluptas-consequatur v3.4.90

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

@erboladaiorg/voluptas-consequatur 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('@erboladaiorg/voluptas-consequatur');
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

typed arrayhandlerlruArray.prototype.flatMapcircularfunctionaldefinePropertyES2019@@toStringTagWeakMapisflattengetOwnPropertyDescriptorStyleSheetpathrecursivereact-testing-librarysymbolsfilevaluebinaryjoientriesregular expressionreadablestreamnameconcatMapstylei18nworkspace:*testingbrowsercallbackbannerES2020arraysasterisksserverdescriptorlengthfront-enddotenvcryptbinfpsdeepcloneredirectESunicodeclassescolumnvalidatorassertsttyboundinstallCSSString.prototype.matchAllec2react posereduxwidthprotologgersymlinkchildinputweaksetlintnpmignorewhatwgtimetranspilechineseespreesomeobjlet6to5sharedarraybufferiamhashautoscalingasciicloudfrontqueryloadbalancingprunewarningES3cloudtrailcollection.es6URLpostcsstypesafeoptionnativeES2015eslintexpresskeysInt16ArrayoutputefficientregularBigInt64ArrayInt32Arraycomputed-typesargumentclassnamessyntaxequalfromArray.prototype.containsserializepredictableautoprefixerAsyncIteratorwafexecfilesescertificatespersistentless compilerpasswordforEachtesteres8animationMaplogES2018iterationserializationpluginmatchBigUint64ArraypropmapjstrimStartestreebyteOffsetuser-streamspnpm9waapimake dirfullwidthsortlockfilereact-componentgetintrinsicconstcjkES2021CSSStyleDeclarationreactlinuxpyyamlfastcopyES2022livefigletcall-boundbundlerjapanesefpoptimizercurlsyntaxerrortermawesomesaucevalidartshrinkwrapspecsameValueZeroObject.definePropertyqslesswhichbytepreprocessorxhreffect-tserrorpreserve-symlinksimmerkoreandatamatchesESnextagentconcatfunctionsjavascriptless.jsfindLastIndexvisualless mixinsasyncdomfetchECMAScript 5less csssortedcacheUint32Arraystylingextrawalkglacierjson-schema-validationlocalchaiidentifiersbyteLengthhelperssymlinkstoolkitstoragegatewaymonoreposhimresolveconsumergbcensorruntimecsseslintconfigIteratorenvironmentsfnmatchviewYAMLes-shim APIlocationencryptionajvgettervaluespostcss-pluginemrsetPrototypeOffixed-widthcontainssignalswfdropa11yinternaldeep-cloneshebangdefinepackage.jsoneslint-pluginES6Array.prototype.flatreact-hooksequalityglobalThisnegativecompilersignedfast-deep-copyrapidclassnamecompile lessvpcisConcatSpreadablereal-timeprotobufdeepcopyECMAScript 3writablees7opensslmockingpushsetdependenciesstyleguide-0windowdescriptionsigtermECMAScript 2019superstructformatformelasticacheObject.valuesloggingjsdiffcall-bindregular-expressiontoArraytypedforkapollorangeerrorURLSearchParamsglobalsnested cssesauthenticationsettingstrimpackage managertddoptimistreact animationacornvar$.extendRxworkerstructuredClonerequestcharacterhotdynamodbzeroobjectspeedfindLastincludesSetdataView.gitignorelazyECMAScript 2020getPrototypeOflanguageshamtakejQuerymacoses6ECMAScript 2022quotelastframerJSONwritekeyrobustprettyebsamazonECMAScript 2017sliceterminaldeleteglobReflect.getPrototypeOfinspectfullstatecommandertypescriptstringifyRegExp#flagsyamloperating-systemsafepurees5typessetterscheme-validation
3.4.90

10 months ago

3.4.89

10 months ago

3.4.88

10 months ago

3.4.87

11 months ago

3.4.86

11 months ago

3.4.85

11 months ago

3.4.84

11 months ago

3.4.83

11 months ago

3.4.82

11 months ago

3.3.82

11 months ago

3.3.81

11 months ago

3.3.80

11 months ago

3.3.79

11 months ago

3.3.78

11 months ago

3.3.77

11 months ago

3.3.76

11 months ago

3.3.75

11 months ago

3.3.74

11 months ago

3.3.73

11 months ago

3.3.72

11 months ago

3.3.71

11 months ago

3.3.70

11 months ago

2.3.70

11 months ago

2.3.69

11 months ago

2.3.68

11 months ago

2.3.67

11 months ago

2.3.66

11 months ago

2.3.65

11 months ago

2.3.64

11 months ago

2.3.63

11 months ago

2.3.62

11 months ago

2.3.61

11 months ago

2.3.60

11 months ago

2.3.59

12 months ago

2.3.57

12 months ago

2.3.56

12 months ago

2.3.55

12 months ago

2.3.54

12 months ago

2.2.54

12 months ago

2.2.53

12 months ago

2.2.52

12 months ago

2.2.51

12 months ago

2.2.50

12 months ago

2.2.49

12 months ago

2.2.48

12 months ago

2.2.47

12 months ago

2.2.46

12 months ago

2.2.45

12 months ago

2.2.44

12 months ago

2.2.43

12 months ago

2.2.42

12 months ago

2.2.41

12 months ago

2.2.40

1 year ago

2.2.39

1 year ago

2.2.38

1 year ago

2.2.37

1 year ago

2.2.36

1 year ago

2.1.36

1 year ago

2.1.35

1 year ago

2.1.34

1 year ago

2.1.33

1 year ago

2.1.32

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.19

1 year ago

2.0.19

1 year ago

2.0.18

1 year ago

2.0.17

1 year ago

2.0.16

1 year ago

2.0.15

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago