4.4.87 • Published 1 year ago

@erboladaiorg/doloribus-quos-officia v4.4.87

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

fast-deep-cloneconsumereversed$.extendstylesheetstyled-componentsFloat32ArrayansinamesetcreateyupECMAScript 2015glacierregular expressionponyfillboundpinoanimationcoerciblehas-ownECMAScript 2022randomlesssharedarraybuffersignalsuuidresolveeslintesomitcssxtermtslibgetoptObject.getPrototypeOfpatchlibphonenumberequalArray.prototype.findLastIndexargumentprototypeES2021ES5sequencelinuxoffsetstringexpressionharmonyArray.prototype.flatcloudtraillocaliteration__proto__propertykeyshotES7jshintless mixinssetterinterruptskoreanmanagercloudsearchefficientUint8Arrayshrinkwrapcloudformationtypeerrors3multi-packageperformancebyteLengthownreadablecryptsignedmake dircontainses8WeakSetstyleassertsshellnopeincludeszxspecECMAScript 5utilsECMAScriptreadES6namesFloat64Arraybabel-corefluxfunction.lengthcurlnpmslicechinesefull-widthmetadatatranspilertransportless cssbrowserlistprotobufWebSocketsigintforEachflatprotocol-buffersmovecallbindfilterglobalThisECMAScript 2016Object.entrieshelperdeepclonedataviewmatchperformantnested cssUnderscorezodIteratorpushcharacterdeep-copydescriptorguidArray.prototype.filterReactiveXtouchrgbhascss nestingchairulesismobilelesscssvaluesinstallgraphqlcheckfileloggingrangeerrorpositiveimportexportfunctionalqueueArrayBuffershimarraybuffermakequeueMicrotaskreduceWeakMapvalidObject.valuesECMAScript 2020dom-testing-librarytypedarraysvpccirculargitignoreextendtranspiletimevaluejwtgesturesreducercompile lessposeexit-codecolumnssafepostcss-pluginjavascripttacit-0warningtddsetPrototypeOfES3typesafeeventEmitterloadbalancingsimpledbpostcssgetintrinsicbyteruntimeInt16Arrayuser-streamspoint-freeargvoptimizerxhrbootstrap csssidejoiECMAScript 6toArrayasciifast-copyObject.ishooksmixinsgdprpackage.jsonlistenersprivateconsolefast-deep-copyYAMLamazonvestbrowserslisttoStringTagoperating-systemes7testfixed-widthbcryptformvariablesmatchesoptimisttsestreeinferencepyyamlshebanges2017copyawses2018flattenelasticachesubprocessTypedArraystylingtc39pluginasyncvargradients csshigher-orderES2018popmotionio-tsHyBifindsuperagentexecutehttpbufferworkspace:*modulesinputless compilerreactBigUint64ArraystringifiertoolssqsspawneveryflatMapjQueryerror-handlingformatoutputtrimEndregular-expressionString.prototype.matchAllpackagesintrinsicrequestObjectbundlingeventsgenerics0trimRegExp#flagsregexJSONdirectorystatelessemitdeep-clonebusyenvironmentswfnegativeaccessorglobconcatbeanstalkimmutableformattingglobal this valuesharederrorjson-schema-validatorterminalgroupBystyleguidepnpm9springshamUint32ArrayECMAScript 2021Uint8ClampedArraylengthhelpersindicatorrfc9562private datafunctionmacosutil.inspectreact posephonejsonschemaeast-asian-widthAsyncIteratorES8getfnmatcharktypeloggeriamjsdiffbinariesconfigurableclassestypesjsxletexecfileartonceredactcolumncloudwatchstyleses2015symbolstatusvarsmapreduceclassnamessymlinksES2017package managerURLSearchParamsnativeutilserializationfantasy-landSymboljschromiumnodecss lessclass-validatorformsmkdirsinternal slotjestes6streamscorefastcopyebsconfigfullSetelbreversetostringtagstoragegatewayreplayECMAScript 3descriptiontypanioncallsymbolsviewArray.prototype.findLastcollectionhardlinkssortArray.prototype.containswindowscensorbininternalauthenticationsetImmediateserializejson-schema-validationurlprunewafutilityrequireglobal objectArray.prototype.includespersistentunicodePromiseESnextdefinespinnerspolyfilldotenvArrayBuffer#slicefile systemawesomesaucelintflag@@toStringTagUint16Array[[Prototype]]colorArraytermbannerJSON-SchemaignorecachewhichtoReversedpureECMAScript 7yamlform-validationchildwaapisettingsdomstringifyextrafroml10nES2022handlersdeterministicclassnameimmersesfast-cloneclientObject.fromEntriestrimRightpropsameValueZerohashWebSocketsmrucall-boundjsdomwritableSymbol.toStringTagArrayBuffer.prototype.sliceRxJSpasswordroutingoptioncertificatesnumberdataViewlastnpmignoreclisorted3dRegExp.prototype.flagscall-bindInt32ArrayserializerfindLastIndexeslint-pluginassertinspecttypeObservableiteratesignalclonehasOwn_.extendmonorepogetOwnPropertyDescriptormodulelruentriesarrayfastclonebrowsergetterasteriskscss-in-jsBigInt64Arrayexecreadablestreamtyped arraymatchAllpicomatchajaxchromecryptocommand-lineES2019TypeBoxECMAScript 2018computed-typestoSortedlinkredux-toolkitArray.prototype.flatMapES2016MapsuperstructairbnbisConcatSpreadablenegative zerosomevariables in cssproto6to5telephonefindLastprocessendercompilerenumerablepipechannelsigtermCSSemrvisualwgetObject.keysglobaltesterfunctionsworkflowfsECMAScript 2017structuredCloneexitcurriedreact-testing-librarytextRFC-6455routebindimportconstdynamodbquerywidthfpsdatastructuretrimStartbufferstrimLeftpreprocessoridleString.prototype.trimconcatMaprecursiveassertionmkdirpobjecthasOwnPropertypathminimaldefinePropertyReactiveExtensionsprettywindowi18nassignes-shimsstreamautoscalingschemasymlinkwriteec2MicrosoftgetPrototypeOfsnsStreamsdateproxylogencryptionautoprefixerbundlertypescriptFunction.prototype.nameloadingfastifyidentifierses-shim APIwhatwgexpressdrages2016commandpreserve-symlinkses5Observablescollection.es6endpointmapfpES2020arraysroute53json-schemapredictablepromisesyntaxmkdirtake.gitignoreregexpPushtypedarraydirdescriptorsslotbyteOffsetgroupweaksetcommandereventDispatcherprogresscloudfrontdataworkerhookformutilitiesregularttyInt8Array
4.4.87

1 year ago

4.4.86

1 year ago

4.4.85

1 year ago

4.3.85

1 year ago

4.3.84

1 year ago

4.3.83

1 year ago

4.3.82

1 year ago

4.3.81

1 year ago

4.3.80

1 year ago

4.3.79

1 year ago

4.3.78

1 year ago

4.3.77

1 year ago

4.3.76

1 year ago

4.3.75

1 year ago

4.3.74

1 year ago

4.3.73

1 year ago

4.3.72

1 year ago

4.3.71

1 year ago

4.2.71

1 year ago

4.2.70

1 year ago

4.2.69

1 year ago

4.2.68

1 year ago

4.2.67

1 year ago

4.2.66

1 year ago

4.2.65

1 year ago

4.2.64

1 year ago

3.2.64

1 year ago

3.2.63

1 year ago

3.2.62

1 year ago

3.2.61

1 year ago

3.2.60

1 year ago

3.2.59

1 year ago

3.2.58

1 year ago

3.2.57

1 year ago

3.2.56

1 year ago

3.2.55

1 year ago

3.2.54

1 year ago

3.2.53

1 year ago

3.2.52

1 year ago

3.2.51

1 year ago

3.2.50

1 year ago

3.2.49

1 year ago

3.2.48

1 year ago

3.2.47

1 year ago

3.2.46

1 year ago

3.2.45

1 year ago

3.2.44

1 year ago

3.2.43

1 year ago

3.2.42

1 year ago

3.2.41

1 year ago

3.2.40

1 year ago

3.2.39

1 year ago

3.2.38

1 year ago

3.2.37

1 year ago

3.2.36

1 year ago

3.2.35

1 year ago

3.1.35

1 year ago

3.1.34

1 year ago

3.1.33

1 year ago

3.1.32

1 year ago

3.1.31

1 year ago

3.1.30

1 year ago

3.1.29

1 year ago

3.1.28

1 year ago

3.1.27

1 year ago

3.1.26

1 year ago

3.1.25

1 year ago

3.1.24

1 year ago

3.1.23

1 year ago

3.1.22

1 year ago

3.1.21

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.19

1 year ago

2.1.18

1 year ago

2.1.17

1 year ago

2.1.16

1 year ago

2.1.15

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

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