3.13.81 • Published 10 months ago

@taktikorg/animi-quam v3.13.81

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

typed-array-byte-offset 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('typed-array-byte-offset');
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

checkexitwaapicompile lesspathkoreanjsserializationmockclonecomparefetchmakerdsStyleSheetstyleguideeventDispatcherdotenvTypeBoxPromisegetOwnPropertyDescriptorFloat64Arrayenderreduxhttpstyled-componentsservice$.extendwarningjshintlistenersinputSymbol.toStringTagtypebyteOffsetasterisksCSSStyleDeclarationfast-deep-copyAsyncIterator256back-endeslintplugineslint-pluginyamlpnpm9postcsscjkhandlersextraflagsmodulefpmkdirsTypedArrayfulleventsjQueryawesomesaucearktypecorebeanstalktraverseflattenreal-timelibphonenumbercolorexecbundlingbinaryrouteArray.prototype.includesvariablesdeep-clonedroppatchdiffutil.inspectsetterWeakSetobjRFC-6455Array.prototype.containsaccessorrgbes5windowentriesexpressionlocalfindLastArray.prototype.findLastIndexes2017globalcallbindstreamscss nestingagentpropertypopmotionECMAScript 2018.gitignoreutilcertificatescss variablelessArrayBuffer.prototype.slicecontainsObjectauthenticationsyntaxsafeacorncloudtrailpropertiesECMAScript 2016Uint8ArrayinterruptsES8astidleajvendpointObject.keystoolsvariables in cssfunctionalrandomtouchdefinePropertydayjsstableECMAScript 2021serializeconcatMapinternals3command-lineworkerclientnodejslastsuperstructpackage managergitignoretddmapreducefixed-widthutilitiesmapregular expressionsharedarraybuffertypesfindLastIndexinstallermake dirtranspilerES2015visualmatchescolorsiteratorreplayelmclass-validatortermimmutablestringifierdeep-copyIteratormetadataECMAScript 2017ES2020airbnbtc39mergepluginRegExp#flagstrimRightspringform-validationES2022esparsergdprviewES6handlerArrayBuffer#slicefluxregexjsonschemaartTypeScripteslintconfigvalidatorobjectintrinsicslicehotrulesmkdirpequalreact-hooksFloat32ArrayargumentfssetPrototypeOfworkflowweakmappinoiamperformantString.prototype.trimtesterebslesscsscollection.es6modulesnegative zerogenericsinternal slottostringtagless.jstrimLeftsymbolUint8ClampedArrayes7collectionec2ECMAScript 3japaneseignorebundlerlintfigletES2021statemacosArray.prototype.flatMaphasOwnPropertyes2016protoarraysregularoptionecmascriptjsonsameValueZerocallboundargv_.extendES5JSON-SchemaWebSocketsansi[[Prototype]]typescripthardlinksbabelprotocol-buffersinferenceObservablesisruntimees-shimsconfigurabletoStringTagencryptiondirtranspilejestprefixgetPrototypeOfestree6to5commanderspeces6autoprefixernpmignorepredictableconcatfilterkinesishasthreeglaciermanagerInt8Arrayselfsigtermequalitycharacterpostcss-pluginuploadutilschildinstallfile systemsetImmediatevaluepyyamlformatasciiomitless csspushstructuredClonecloudsearchstyleglobfastifyES2018shebanggradients css3irqreducerwaitstylesheetreact poseiterationspinnersfullwidthFunction.prototype.nameproxyrobustpolyfillbrowserslistgetString.prototype.matchAllES2019deepcloneReactiveXhasheventEmitterramdaWebSocketes8
3.13.81

10 months ago

3.13.80

10 months ago

3.13.79

10 months ago

3.13.78

10 months ago

3.13.77

10 months ago

3.12.77

10 months ago

3.12.76

10 months ago

3.12.75

11 months ago

3.12.74

11 months ago

3.12.73

11 months ago

3.12.72

11 months ago

3.11.72

11 months ago

3.11.71

11 months ago

3.11.70

11 months ago

3.11.69

11 months ago

3.11.68

11 months ago

3.11.67

11 months ago

3.11.66

11 months ago

3.11.65

11 months ago

3.11.64

11 months ago

3.11.63

11 months ago

3.11.62

11 months ago

3.11.61

11 months ago

3.11.60

11 months ago

3.10.60

11 months ago

3.10.59

11 months ago

3.10.58

11 months ago

3.10.57

11 months ago

3.10.56

11 months ago

3.10.55

11 months ago

3.10.54

11 months ago

3.10.53

11 months ago

3.10.52

11 months ago

3.10.51

11 months ago

3.9.51

11 months ago

3.9.50

11 months ago

3.9.49

11 months ago

3.9.48

12 months ago

2.9.48

12 months ago

2.9.47

12 months ago

2.9.46

12 months ago

2.8.46

12 months ago

2.8.45

12 months ago

2.8.44

12 months ago

2.8.43

12 months ago

2.8.42

12 months ago

2.8.41

12 months ago

2.8.40

12 months ago

2.8.39

12 months ago

2.8.38

12 months ago

2.8.37

12 months ago

2.7.37

12 months ago

2.6.37

12 months ago

2.6.36

12 months ago

2.6.35

12 months ago

2.6.34

12 months ago

2.6.33

12 months ago

2.6.32

1 year ago

2.6.31

1 year ago

2.6.30

1 year ago

2.6.29

1 year ago

2.6.28

1 year ago

2.5.28

1 year ago

2.5.27

1 year ago

2.5.26

1 year ago

2.5.25

1 year ago

2.5.24

1 year ago

2.5.23

1 year ago

2.5.22

1 year ago

2.5.21

1 year ago

2.5.20

1 year ago

2.5.19

1 year ago

2.5.18

1 year ago

2.4.18

1 year ago

2.4.17

1 year ago

2.3.17

1 year ago

2.3.16

1 year ago

2.3.15

1 year ago

2.3.14

1 year ago

2.3.13

1 year ago

2.3.12

1 year ago

2.3.11

1 year ago

2.3.10

1 year ago

2.3.9

1 year ago

2.2.9

1 year ago

2.2.8

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.2.5

1 year ago

2.2.4

1 year ago

2.2.3

1 year ago

2.2.2

1 year ago

2.1.2

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago