3.7.80 • Published 12 months ago

@zitterorg/deserunt-beatae-fuga v3.7.80

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

regularObject.definePropertyvaluesArray.prototype.flatvestfunctionalframeworkcolourWeakMapvpcRxPushdeep-copykeysdefineWebSocketstypesafeECMAScript 2022stylingcliArray.prototype.includeslimitedes6jsonString.prototype.trimloggercharsethttpeventDispatcherRxJSbrowserslistcore-jsawaitespreeagentweaksetcomparecallreact-hookshardlinksi18nconsolecollection.es6deepcopyarktypesetterapolloupbddtostringtagECMAScript 2016lintclonebeanstalkSymbol.toStringTagworkerlogging-0fast-cloneshimcss-in-jsmapReactiveXfastgenericsmatchwaitlazyvalidatesymbolcryptoreact animationfunction.lengthYAMLpostcss-pluginstablearraydependenciesfind-upinferencegetoptcontainsmatchAllsyntaxspecwritablewordwrapautoprefixerreactcode pointswhatwgimportexportprogresspipewhichincludessequenceclass-validatortypescriptES2015toSortedUint16ArrayrecursiveObject.assignloadingStreamttytypescommandersymbolsrangeerrorhassort256flaghttpsHyBizerohashzodapiObject.getPrototypeOfformattingxhrECMAScript 7nodecollectionenvironmentsregular expressionfolderimmeraccessibilitycolornegative_.extendstdlibRFC-6455look-upcjkArrayBuffer#slicehooksbreaklinewrapcall-boundemitMapECMAScript 2019escapeprotocol-bufferselasticachebundlingl10nchromebyteglaciercoerciblerobustopenerdayjsecmascriptObject.ispackage managerbuffersthreearraybuffercallbindRegExp.prototype.flagssetloadbalancingeventsdataviewequalitypopmotionnativefindLaststreams2awesomesaucejsonpathES2020patchscheme-validationhookformoutputreduceInt8Arraylibphonenumberwaapiprivate dataurlspyyamlmruInt32Arraypathasynctoobjecttoolkites8getjsdiffUint8ClampedArrayguidindicatorparentidlesidejsthrottlepromiseboundresolveES2018schemermdirreact-hook-formperformantexecconfigurabletypeofbatchonceutilitiesautoscalinglognodejsassertsnsponyfilloptimizertrimStarteslintconfigMicrosoftbundlerfixed-width
3.7.80

12 months ago

3.7.79

12 months ago

3.6.79

12 months ago

3.6.78

12 months ago

3.6.77

12 months ago

3.6.76

12 months ago

3.6.75

12 months ago

3.6.74

12 months ago

3.6.73

12 months ago

3.6.72

12 months ago

3.6.71

12 months ago

3.6.69

12 months ago

3.6.68

12 months ago

3.6.67

12 months ago

3.6.70

12 months ago

3.6.66

12 months ago

3.4.58

1 year ago

3.2.35

1 year ago

3.4.59

1 year ago

3.3.47

1 year ago

3.2.34

1 year ago

3.3.48

1 year ago

3.2.37

1 year ago

3.5.66

12 months ago

3.3.49

1 year ago

3.2.36

1 year ago

3.2.39

1 year ago

3.2.38

1 year ago

3.4.51

1 year ago

3.4.52

1 year ago

3.4.53

1 year ago

3.4.54

1 year ago

3.4.55

1 year ago

3.4.56

1 year ago

3.2.33

1 year ago

3.4.57

1 year ago

3.2.46

1 year ago

3.2.45

1 year ago

3.2.47

1 year ago

3.4.61

1 year ago

3.4.62

1 year ago

3.3.50

1 year ago

3.4.63

1 year ago

3.3.51

1 year ago

3.2.40

1 year ago

3.4.64

1 year ago

3.4.65

1 year ago

3.2.42

1 year ago

3.4.66

1 year ago

3.2.41

1 year ago

3.2.44

1 year ago

3.2.43

1 year ago

2.2.33

1 year ago

3.4.60

1 year ago

2.2.32

1 year ago

2.2.31

1 year ago

2.2.30

1 year ago

2.2.28

1 year ago

2.2.29

1 year ago

1.2.26

1 year ago

2.2.26

1 year ago

2.2.27

1 year ago

1.2.23

1 year ago

1.2.24

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.2.25

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.0.11

1 year ago

1.1.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

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