1.8.96 • Published 10 months ago

@diotoborg/odit-nostrum-consequuntur v1.8.96

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

@diotoborg/odit-nostrum-consequuntur 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('@diotoborg/odit-nostrum-consequuntur');
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

npmobjectfasttacitfast-deep-clonedeep-copydescriptiontoArrayUint16Arrayagentcss variableMicrosoftelectronrobustjavascriptsigintpolyfillimporttrimStartpromiseES8regexpyupcurlObject.getPrototypeOfhardlinkswidthECMAScript 2022shamreducemake dirArray.prototype.flatMapacornefficientObject.fromEntriesexpressionemitless mixinsbyteLengthArray.prototype.findLastliveoffsetURLtranspilefluxmergeansiWeakMapflatMapArray.prototype.findLastIndexSystem.globalcloudsearchpatchauthenticationpropajaxapioptimizerflagnegative zerorapidasteriskses8idleimmeronceflattenflatObject.keysnodecensorjQueryisnested csschecksidecalldeepcloneECMAScript 5json-schema-validationdataviewrouteconsumelazystatushotTypeScriptbabelfastcopyhigher-orderzodparsershebangcss nestingtypedarrayslastECMAScript 6streamstylesArrayBuffer#sliceargumentgetignoreES2015iteratorhasOwnPropertyJSON-SchemadependencieswindowcoerciblesequencetslibformatsameValueZerooutputdataViewcomparelockfileencryptiontestersetcall-bindfastifybufferstestpreprocessornameshelpersforEachreduxmatchfindLastIndexInt16Arrayawscallbindless compilerBigUint64ArraydeepcopybinariesttyString.prototype.matchAllroute53s3logECMAScript 2019pushweakmapsimpledbstylingguidsettingstelephoneMapbannertraversestylecontainsenumerableclassnamephone.gitignorecolorcoreprunesuperstructchromiumsymlinksconstpyyamldatasnsajvreverseserializeridentifiersUnderscoresyntaxbyteOffsetelasticachetextgroupBycloudfrontmanagersqsinspectObject.entriesstringifyarktypedroploggingbinbrowserlistpersistentwhichES7validationchildsymbolimmutabletoolkittypanionutilrulessubprocessrecursiveinternal slotescapeaccessorECMAScriptwhatwguninstallsafepipetypeslocalfiltersettererror.envshellArrayBufferstringifieres6installES2019package managerUint32ArraycharacterfastcloneartarraybuffercolorsqueryexpressfromcryptES5prototypegenericsinvariant[[Prototype]]call-boundmobilepnpm9Object.isyamleventDispatchertoobjectpackage.jsonstableformsuuidproxyserializegitignoreless cssdependency managerclilruoperating-systemmulti-packagetrimRightECMAScript 2017pluginglobalnopeprotobufmkdirpglacierfast-cloneSymboldeterministicenderautoprefixerslotsetPrototypeOfsortFloat32Arrayform6to5classnameshas-ownWebSocketsframerastmoveObservablesnumberglobalThisESfsquotetoReversedxtermtoolsobjprivateassignfast-copyxhrfetches2016@@toStringTagargsflagsvariables in cssloadbalancingexecuteArray.prototype.flattenJSONprogressmapreducestoragegatewayFloat64ArraykinesisselfES2020Arrayreact-componentutilsworkspace:*copyjsdomglobES2017gradients css3waapiReactiveXargvponyfilla11ytoStringTagmrues7regular expressionvisualrgblessUint8ClampedArraytestingsetImmediatejshintloggerstatelessrandomtddi18nnodejsCSSdatastructuremapconcatMapES2022fpchaicss-in-jsjsonschemascheme-validationutil.inspectTypedArrayAsyncIteratorinstallermixinsbrowserslisturlecmascriptreact animationimportexportglobalstrimEndvestshimqueuejapaneseRxJSmakehttpexecfileworkererror-handlingperformanceirqsignalsHyBiArray.prototype.containsgetterdom-testing-libraryECMAScript 7computed-typescommand-linehookformhelperES3Object.definePropertycolumnslesscssprivate databindURLSearchParamsvalidlinkdirbabel-corebundlerrdswaitrangeerrorcompilerhasrequirepure256modulesredux-toolkitjwtdirectorypositivepreserve-symlinkssigtermrfc4122deleteresolvedeeptransportanimationjsdiffweaksetairbnbsomees2018stringoptimisteveryequalitysymbolspredictableomithasOwngraphqljestwaffast-deep-copypackagesclonepostcssschemekoreanawesomesaucepropertiesglobal objecttypeObjectregular-expressiontypedarrayfullwidthjson-schemastategetintrinsiclinuxminimales-shimsexit-codeWeakSetwalkreact-testing-libraryObject.assigncertificatesES2016ES2018estreeequalclassesthreeendpointnegativeprefixlintECMAScript 3byteelmjoigdprapolloes-abstractes-shim APIwarningcsscommanderdeep-clonestreamsswftsreact poseglobal this valueiterationregexbusykeystranspiler0real-time__proto__valuesownprotodragreact-hook-formpicomatchjsontrimemrreadcommandsyntaxerrorfullmodulejsxinternalcurriedPushhttpsarraysArray.prototype.includesexecprotocol-buffersiamterminales5cloudwatchutilityECMAScript 2018colourtyped arrayl10ntypescriptpropertyreversedstructuredClonecircularwritablechannelconfigschemaautoscalingbufferinterruptsgradients cssconcatruntimeECMAScript 2020Object.valuesmkdirsgroupextendfilechineseentriesmatchesdefinePropertyzxObservablezerospinnersparsewgetfixed-widthqueueMicrotaskremovereducerrequestcloudtrailSetnpmignorebddcloudformationvarsfile systemenvironmentsassertuploadgetPrototypeOfgetOwnPropertyDescriptorieincludesprettyharmonyisConcatSpreadableBigInt64ArrayassertsvarfpssharedarraybufferspeedESnextmomentformattingIteratorECMAScript 2015PromisereadablereusepopmotiongetoptindicatormacosquerystringES2023ECMAScript 2016eslint-pluginclass-validatorhashCSSStyleDeclarationhandlersfunctionalsortedposeconsolebcryptbrowserjsrfc9562
1.8.96

10 months ago

1.8.95

10 months ago

1.8.94

10 months ago

1.8.93

10 months ago

1.8.92

10 months ago

1.7.92

10 months ago

1.7.91

10 months ago

1.7.90

10 months ago

1.7.89

10 months ago

1.7.88

10 months ago

1.7.87

10 months ago

1.7.86

10 months ago

1.7.85

10 months ago

1.7.84

10 months ago

1.7.83

10 months ago

1.7.82

10 months ago

1.7.81

10 months ago

1.7.80

11 months ago

1.7.79

11 months ago

1.7.78

11 months ago

1.7.77

11 months ago

1.7.76

11 months ago

1.7.75

11 months ago

1.7.74

11 months ago

1.7.73

11 months ago

1.7.72

11 months ago

1.7.71

11 months ago

1.7.70

11 months ago

1.7.69

11 months ago

1.7.68

11 months ago

1.7.67

11 months ago

1.6.67

11 months ago

1.6.66

11 months ago

1.5.66

11 months ago

1.5.65

11 months ago

1.5.64

11 months ago

1.5.63

11 months ago

1.5.62

11 months ago

1.4.62

11 months ago

1.4.61

11 months ago

1.4.60

11 months ago

1.3.60

11 months ago

1.3.59

11 months ago

1.3.58

11 months ago

1.3.57

11 months ago

1.2.57

11 months ago

1.2.56

11 months ago

1.2.55

12 months ago

1.2.54

12 months ago

1.2.53

12 months ago

1.2.52

12 months ago

1.2.51

12 months ago

1.2.50

12 months ago

1.2.49

12 months ago

1.2.48

12 months ago

1.2.47

12 months ago

1.2.46

12 months ago

1.2.45

12 months ago

1.2.44

12 months ago

1.2.43

12 months ago

1.2.42

12 months ago

1.2.41

12 months ago

1.2.40

12 months ago

1.2.39

12 months ago

1.2.38

12 months ago

1.2.37

12 months ago

1.2.36

12 months ago

1.2.35

1 year ago

1.2.34

1 year ago

1.2.33

1 year ago

1.2.32

1 year ago

1.2.31

1 year ago

1.2.30

1 year ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.2.17

1 year ago

1.2.16

1 year ago

1.2.15

1 year ago

1.2.14

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.2.11

1 year ago

1.2.10

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