3.9.83 • Published 11 months ago

@erboladaiorg/ullam-ad-necessitatibus v3.9.83

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

@erboladaiorg/ullam-ad-necessitatibus 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('@erboladaiorg/ullam-ad-necessitatibus');
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

iterationWebSocketsterminalyamltext$.extendhigher-ordercryptfantasy-landpredictablekeydependenciesWebSocketcontains@@toStringTagSetES2019constbundlingfindCSSStyleDeclarationclass-validatorpackagesrapiddataViewenvironmentsfunction.lengthspringtypeprivateFunction.prototype.namegetPrototypeOfshareddeep-copypreserve-symlinksbinroute53classnamesUint8ClampedArraypolyfilltesterstreamsgettertypeofenumerableeast-asian-widthRxobjspinnerbabel-corestylesheetmanagerMap-0eventsquoteprototypePushrfc4122prunetoSortedobjectcloudtrailweaksetpromiseECMAScript 2017oncefpsrecursiveshimboundES2021parserArray.prototype.includesES7iam__proto__wafless mixinsstatuscryptopyyamlswfeveryttyinECMAScript 3pipestructuredCloneparsevisualreact poseequalhasOwnPropertyoffsetURLfastcopysharedarraybufferwindowssigtermnegativemobilexhrreact-hooksindicatorprocess3dArray.prototype.flatMaptoReversedreversemrustyleES8findLastmkdirECMAScript 2020setPrototypeOfInt32Arrayqueueruntimecurlinferencedescriptortypedarrays.gitignoreutilsexit-codecolumnsideomitfromReactiveXtypesafelastObject.fromEntriesUint16ArraynpmignoreinternaljestregularsliceshamexecpostcsseventEmitterReflect.getPrototypeOfautoprefixerStreamshardlinkslinuxtoStringTagcallbacksignedvalidjoiargsjsonschemachaiefficientbabelArrayBuffer#slicereactpopmotionArray.prototype.findLasttakeECMAScript 7classesbootstrap cssconfigarraystimesyntaxcolourcolumnswaitqueueMicrotaskchineseObject.definePropertywalkqsbundlerchromeexpressionexecfilegdprSymbolvaluejshintlanguageUnderscoretypescriptfunctionalUint32ArrayfastclonedeterministicstatelessObject.iswhatwgstablenodejssequencevariablespureoperating-systemartidletranspilertoArraycodescensorassertseffect-tsparsingelasticachejson-schemacore-jsrandomignoreencryptionirqcompile lesstostringtagapolloconsoleless compilerweakmapes-abstractgetOwnPropertyDescriptoriekinesispreprocessorestreenodeRegExp.prototype.flagsArray.prototype.flatendpointsnsES2017fast-copyextrajsonconcatObject.entriesglobal objectassignspecisConcatSpreadableequalityBigInt64ArraynpmYAMLECMAScript 2021elmArray.prototype.containsasterisksregexplessremovetrimStartprogressloggingprefixsymlinkdropmulti-packageArrayBuffer.prototype.sliceyuppersistentlivecheckchromiumtypeerror.envreact animationshebangschemahashhas-ownfull-widthdayjstacitwidthrouteES2023flagfigletfasttelephonecompilerreplayRFC-6455workerhookscertificateses-shimssuperagent256cssfluxapiArray.prototype.filtervarfullwidthchannelSymbol.toStringTagdeep-clonegraphqlWeakSetfile systeminputworkflowflatshrinkwrapclonecoercibledescriptionECMAScripttscircularincludesargvArray.prototype.findLastIndexsettingstestingdaterequestlistenerses2017modulereadTypedArrayemrcss lessreadablemixinsInt16ArrayextendObject.assignES2020performanceTypeBoxhandlerstrimEndassertgroupByjsxjwtArrayBufferpackage.jsoncallbindlesscssvalidatorpropertyserializationredactiterateacorncreatecommand-linefsIteratoremitramdaargumentES2018testFloat32Arraycall-boundflattenObject.keysutils3dataviewmodulesformawsmapreducestyleguide0findLastIndexformattingxtermURLSearchParamszxessomecomputed-typesphonepnpm9veststatenegative zeroreact-hook-formJSON-SchemaStreamECMAScript 2015stringkoreanawesomesaucenopespawnanimationes6user-streamsRegExp#flagsisviewponyfillreversedcliframerprotobrowsercall-bindhelperECMAScript 2022WeakMapECMAScript 2023speeddescriptorsmatchAllCSSnameelbtyped arrayi18narraybufferlengthglobalbyteOffseteslintdynamodbwhichsignalsoutputgradients css3airbnbcoreimmermergeeventDispatchernumbermetadataES2022childtrimRightinternal slotansibcryptoptimistless.jsintrinsicform-validationimportMicrosoftfilterECMAScript 2019a11ypatharraytranspilesymlinkshelperscloudwatchObject.valuessetImmediatesignalglobwriterobustdragString.prototype.matchAlles8reduceunicoderdsmkdirsString.prototype.trimbannerminimalbyteLengthstringifierproxyreadablestreamcloudfrontjson-schema-validationbinariesbootstrap lessmovegradients csscollectiondeeptraverseconsumeloadbalancingtypedarrayhasperformantES2015fullbusyaccessibilityopensslinterruptstermec2bufferses2018harmonyworkspace:*Array.prototype.flattenagentoptimizerquerynested cssaccessordeleteasciiroutingdefinedatastructuresortfast-cloneerror-handlingio-tshasOwndom-testing-libraryownresolvestylescharacterecmascriptastArrayes-shim APIpostcss-pluginthreevalidatecopysafejsmatchsesuninstallnativedefinePropertyposegitignorebdddirstyled-componentsinvariant
3.9.83

11 months ago

3.9.82

11 months ago

3.9.81

11 months ago

3.9.80

11 months ago

3.9.79

11 months ago

3.9.78

11 months ago

3.9.77

11 months ago

3.9.76

11 months ago

3.9.75

11 months ago

3.9.74

11 months ago

3.9.73

11 months ago

2.9.73

11 months ago

2.9.72

11 months ago

2.9.71

11 months ago

2.9.70

11 months ago

2.9.69

11 months ago

2.9.68

11 months ago

2.9.67

11 months ago

2.8.67

11 months ago

2.8.66

11 months ago

2.8.65

11 months ago

2.8.64

11 months ago

2.8.63

11 months ago

2.8.62

11 months ago

2.7.62

11 months ago

2.7.61

11 months ago

2.7.60

11 months ago

2.7.59

11 months ago

2.7.58

11 months ago

2.6.58

11 months ago

2.6.57

12 months ago

2.6.56

12 months ago

1.6.56

12 months ago

1.6.55

12 months ago

1.6.54

12 months ago

1.5.54

12 months ago

1.5.53

12 months ago

1.5.52

12 months ago

1.5.51

12 months ago

1.5.50

12 months ago

1.5.49

12 months ago

1.5.48

12 months ago

1.4.48

12 months ago

1.4.47

12 months ago

1.4.46

12 months ago

1.4.45

12 months ago

1.4.44

12 months ago

1.4.43

12 months ago

1.4.42

12 months ago

1.4.41

12 months ago

1.4.40

1 year ago

1.4.39

1 year ago

1.4.38

1 year ago

1.4.37

1 year ago

1.4.36

1 year ago

1.4.35

1 year ago

1.4.34

1 year ago

1.4.33

1 year ago

1.4.32

1 year ago

1.4.31

1 year ago

1.4.30

1 year ago

1.4.29

1 year ago

1.4.28

1 year ago

1.4.27

1 year ago

1.4.26

1 year ago

1.4.25

1 year ago

1.4.24

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

1 year ago

1.1.6

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