4.5.87 • Published 11 months ago

@taktikorg/voluptatum-quis-quod v4.5.87

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

optionless.jsiterationramdarequireagentfullwidthdataViewReactiveExtensionssignedreducercss variablestatelesscore-jsspeedmkdirreverseelectronsyntaxtypedayjsspawninterruptswhatwgdeep-copybinbinariesfluxdateregular-expressionpinoenvdependency managergitignoreunicodedirectorypersistentWeakMapbcryptsortedecmascriptSetfile systemflagcloudfrontequalquerystringignoreviewoptimistintrinsiccjkpatchArray.prototype.findLastIndexprivatedatastructuretransportCSSconcatMapgenericsvalidationregularStreamjapanesefastifyvariables in cssinstallsetPrototypeOfvariablesredactformssettingsES2016bind256forkreact-componentclassnamereuseRxJSsyntaxerrorreact-testing-libraryspinnerjsonYAMLtraverseschemedependenciesreactbeanstalkString.prototype.trimgdprECMAScriptloggingcompile lesswaitfast-deep-clonereadablees-abstractfull-widthutilityglobal objectfsregular expressionObservablehandlerseventDispatcherstringvarstypesafetstelephonearktypeES2015subprocessaccessibilityworkspace:*glacierserializewarningcommandertypedCSSStyleDeclarationprefixjQueryjson-schema-validationjson-schematypeofshrinkwrapnested cssstoragegatewayselfautoprefixerhigher-orderdataviewtoReversedbrowserlistwhichgradients css3constthreeendpointhooksfunctionsutilbrowserpackage.jsontrimEndless cssaccessorjsonschemaform-validationInt8ArraystylingajvqueueMicrotaskfindLastIndexchromei18nextendserializerweakmapurlcoreTypeScriptencryptionoffsetless mixinsinternal slotsequencecallboundswfmkdirpgetOwnPropertyDescriptorpureinstallerautoscalingObject.keyssqsreact-hook-formsomeshimjsobjectpnpm9StreamsemrprettyformatpositivespecbusymatchguidindicatornodesignalvpctddfileclientcloudwatchbuffershebangObject.getPrototypeOfECMAScript 5real-timeprivate dataES5-0ECMAScript 2016matchesminimalremovecryptofetchcss nestingstarterfunctionmulti-packageObject.fromEntriespreprocessormetadataclassnamesbuffersES6lazycolorentriesloggerformObject.isopensslmkdirsuploadpreserve-symlinkspostcsskeysdeepcopyreact posesafecloneframerflatMapharmonyacornrequestJSON-SchemaObject.definePropertyeslint-pluginmapes2017call-binda11ytypedarrayscontainshttpfptypedarraysesHyBitoStringTagasteriskspyyamlsortArrayprotobufexpressglobalThisSymbol.toStringTagdatazodboundproxyArray.prototype.flatcertificatesanimationforEachrulesstreamreduxsuperstructroutingrapidtslibpasswordfindLastsigintec2xhrassertsArray.prototype.flattensetImmediateauthenticationserializationreversedbabeldropio-tsjavascriptpruneUint16Arraytyped arrayInt32Arrayhotchaibootstrap lesslinuxlesscssliveES2020deleteObservablesutilstostringtagslot0concatstreamsECMAScript 2020sigtermmodulecryptwalkwindowECMAScript 6workerdeterministicyupglobalsloadingequalityasyncapil10ncommand-linelocalURLSearchParamsBigUint64Arrayerrorargslengthmake dircloudtrailroutelastArray.prototype.containsmapreduceastInt16ArrayUint8ClampedArraysimpledbmergevalidatorchecklessyamlfunctionalimportpropertylrucopyWeakSetdescriptorscolumnes7typesECMAScript 2018toArraycodesString.prototype.matchAllmodules@@toStringTagfast-deep-copyomitMapquoteiteratormrucensorformattingkeyvisualchildcurriednativeamazoniedeeptoolsESnextfast-clonehasRxgroupwritablefindeventEmitterinternalparsercoloures2015UnderscoreinferencesettercolorsnumberArray.prototype.flatMapansitypeerrorzxiterateoperating-systemstringifyBigInt64Arrayglobalrfc4122gradients csstimediffdirapolloxtermrgbprop[[Prototype]]Object.valuesESObject.assignauthincludespackagesobjbabel-corenpmignoreparseconfiginvariantconsolemomentECMAScript 2021pathreplayAsyncIteratormakeinputJSONRegExp#flagsexecfilecollection.es6nodejs.envconsumebyteenumerableclass-validatorcacheerror-handling__proto__call-boundnameUint8Arrayfromjsdiffreadablestreamarraybufferglobal this valueargumentgesturesIteratorshellFloat32ArraywaapieslintconfigArray.prototype.includesnamesflattenendernopenegativetakescheme-validationincommandisConcatSpreadable.gitignorefilteruuidpredictablemobilelistenersES2018manageres6tc39sharedhardlinkscollectionprotoeffect-tsflatfastcloneimportexportphonelockfileReactiveXbundlingfixed-widthjsdomplugindescriptorsymlinksArrayBuffer#slicetestes5descriptionES8deepclonedomzerotesterperformanceexecnegative zeroexitowndynamodbArray.prototype.filterECMAScript 2019ponyfillES2023clichinesepicomatchcss-in-jswriteprocesstestingpipeelasticachepopmotionenvironmentarraybyteOffsetenvironmentseventsFloat64ArrayestreepropertiestoolkitawscallES3util.inspectstableterminalRegExp.prototype.flagstextsameValueZeroemitkinesisairbnbECMAScript 2023redux-toolkitArrayBuffer.prototype.slicebootstrap cssimmercoercibleroute53runtimeES2017eslintstylesheetFunction.prototype.namegettypescriptbddgetintrinsichelperartwidthkoreanreact-hookstermvalidfnmatchMicrosoftjshintebsidentifierspackage managerimmutableutilitieslethas-ownquerypolyfillECMAScript 2022ECMAScript 2015toobjectdeep-clonelanguagedom-testing-libraryrecursivecomputed-typesreadjwt6to5$.extendhasOwnrandomchannelcreatemovelintfigletPushcolumnsfastposees2018Object.entriesirqcssObjectnpmURLjsxmixinsdefinePropertyclasseseast-asian-widthregexpvalidateassignES2021valueglobjoihookforms3spring3dbyteLengthtrimLefteseveryjestajaxprogresstrimRighttouchtranspileweaksetconfigurablespinnerschromiumcallbindes2016Reflect.getPrototypeOfrobustpoint-freeextraECMAScript 2017stylespostcss-pluginmonorepoTypeBoxsnscircularfastcopylibphonenumberfunction.lengthtrimwindowscompilerelmES7outputSymbolpromisehttps
4.5.87

11 months ago

4.5.86

11 months ago

4.5.85

11 months ago

4.5.84

11 months ago

4.5.83

11 months ago

3.5.83

11 months ago

3.5.82

11 months ago

3.5.81

11 months ago

3.5.80

11 months ago

3.5.79

11 months ago

3.5.78

11 months ago

3.5.77

11 months ago

3.5.76

11 months ago

3.5.75

11 months ago

3.5.74

11 months ago

3.5.73

11 months ago

3.4.73

11 months ago

3.4.72

11 months ago

3.4.71

11 months ago

3.4.70

11 months ago

3.4.69

11 months ago

3.3.69

12 months ago

3.3.68

12 months ago

3.3.67

12 months ago

2.3.67

12 months ago

2.3.66

12 months ago

2.3.65

12 months ago

2.3.64

12 months ago

2.3.63

12 months ago

2.3.62

12 months ago

2.3.61

12 months ago

2.3.60

12 months ago

2.3.59

12 months ago

2.3.58

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.3.53

12 months ago

2.3.52

12 months ago

2.3.51

12 months ago

2.3.50

1 year ago

2.3.49

1 year ago

2.3.48

1 year ago

2.3.47

1 year ago

2.3.46

1 year ago

2.3.45

1 year ago

2.3.44

1 year ago

2.3.43

1 year ago

2.3.42

1 year ago

2.3.41

1 year ago

2.3.40

1 year ago

2.3.39

1 year ago

2.3.38

1 year ago

2.3.37

1 year ago

2.3.36

1 year ago

2.3.35

1 year ago

2.3.34

1 year ago

2.3.33

1 year ago

2.3.32

1 year ago

2.3.31

1 year ago

2.3.30

1 year ago

2.3.29

1 year ago

2.3.28

1 year ago

2.3.27

1 year ago

2.3.26

1 year ago

2.3.25

1 year ago

1.3.25

1 year ago

1.3.24

1 year ago

1.3.23

1 year ago

1.3.22

1 year ago

1.3.21

1 year ago

1.3.20

1 year ago

1.3.19

1 year ago

1.3.18

1 year ago

1.3.17

1 year ago

1.3.16

1 year ago

1.3.15

1 year ago

1.3.14

1 year ago

1.2.14

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

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