8.13.105 • Published 11 months ago

@taktikorg/facilis-itaque-ut v8.13.105

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

@taktikorg/facilis-itaque-ut 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('@taktikorg/facilis-itaque-ut');
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

package managerrateboundreworkfsjoirm -rfcall-bindjseventEmitterroutingFloat64Arrayworkspace:*concatimportECMAScript 2020regexpeslintconfigvalueemitfixed-widthpatchfastclonehigher-orderasyncrfc4122toSortedhookformtrimEndInt32ArraycloudfrontbyteLengthunicodeguidautoprefixertypeswarningstdlibmochabddlocalgetintrinsicreact animationstablepackagesreact posenpmreact-hook-formrequirerangeerrorjsxlinewrapgesturesstylesgdprcolumnsiteratebrowserslistsimpledbsideUint32Arraystreams2ES6HyBipopmotionlruimmermakereact-testing-librarycomputed-typesart__proto__symbolvalueslookreactUnderscoregetPrototypeOfgetoptformattingtrimRightflatMapcallbackjavascriptreducerAsyncIteratortoolssafeieexecutecloudtrailbannerstructuredCloneESforkPromiseSymbol.toStringTagwebsiteisArray.prototype.flatwhichcorewordwrapredactcommandermkdirsfunction.lengthautoscalingproxyebsvpcES2016has-ownReflect.getPrototypeOfbufferswfObject.entrieswidthfastifyshamrm -frshebangfast-copydeterministicmkdirpcoercibleassertsdatastructurenodeWeakMaplocationhttpssuperagentterminalcore-jsstyled-componentswrapUint8ClampedArrayWebSocketsemrObservablespringdomgraphql-clientchaiArrayES2023ES2021timemomentECMAScript 5extendgetqueueMicrotaskes-abstractweakmaptypeddayjsttymonorepotesterprotobufbundlerextrasource mapincludestapeArray.prototype.flattenpreserve-symlinksdeepfastbinenvprototypetaskworkflowURLcurllook-up256sliceRegExp#flagsperformantansiCSSPushsearchfeedcryptoReactiveXsettingsregular expressiondotenvmkdirmake dirtypedarrays-0symlinksphonermdirdependenciesspecjasminepushmatchAllObject.assignsameValueZerojshintxmlefficientopenlogdefineawesomesauceapolloglobalsreal-timeprocessSetzoddropmoduletypeerroreventDispatchertypelimitfastcopyregularjestdynamodbrapid@@toStringTagsesstoragegatewayloggingstartereslint-plugineventstrimLeftbusy.enveast-asian-widthrobustjapanesesymlinkBigUint64ArraywritepersistentreadablestreamECMAScript 2023CSSStyleDeclaration0WeakSetoncedeletesomeec2outputindicatorponyfillObservablescomparehtmlfast-deep-clonequeryesrsspreprocessorRxtslibinspectspinnersdateWebSockettyped arrayprogressdefaultwordbreakappdependency managershrinkwrapTypedArrayArray.prototype.findLastkeydirectoryObjectqueuemergetraverseSymbolfindLastIndexcachetostringtagES8kinesisdom-testing-libraryflatinferencetrimbluebirdlockfileescaperedux-toolkitstreamintrinsicstringifyspeedlintes2016expressioncommandanimationObject.valuesatomcompilerfoldercopycharacternamereducetransformexethrottlecall-boundemojitsfast-deep-copydescriptionstringnumbermulti-packageargses2015$.extendfunctiondeepcopybreakecmascriptperformancecodesmovetapidledescriptorscloudsearchloadingURLSearchParamsratelimitastrandomBigInt64Arrayxdg-openkeysendertc39sortminimalUint16Arrayxhrloadbalancingwritablelanguageajvpathhttpwhatwgshellio-tstypeofnodejsString.prototype.matchAllfind-upeslintpluginiampostcssArray.prototype.flatMaphasglacierglobES3ECMAScript 2022drages2017chromiumcssarraymapbatchfilterassertionworkerhasOwnvalidECMAScript 2015testingFloat32ArraystylearraysrdskarmaReactiveExtensionscallbrowserbyteOffsetrgbkoreanStreamsequalMicrosoftframeridentifierszxflattenidisConcatSpreadablecontainsmatchresolvechineseimportexportutilconfigurablei18ntypescriptprotocol-buffersprivate dataECMAScript 2018promisereusespawnRegExp.prototype.flagsoffsetflagwafcircularawaiturlfunctionsrecursivevalidationinstalleres-shimses2018threesharedarraybufferobjcliobjectdataViewchannelawsinvariantoptimizerwaapiestreeformatnamesESnextES2015startsyntaxdeep-copyimmutableasciipipeomitjsdiffECMAScript 6helpergroupreadeslintstreamsfromtrimStartes6matchesposefpsamazonredirecttoobjectassigntoolkites-shim APIlinkviewes8sortedwgetmanipulationpackage.jsonsetconcurrencypositiveeditorgraphqlspinnernopediffargumentscollectionfindmobiletranspilerES5validateUint8Arraypromisescollection.es6qsoptimistruntimehookscolorsmapreducezeroairbnbclass-validatordirassertcloudwatchpolyfillxtermmruECMAScript 2016descriptoroptionstatelessdatas3jsones7_.extendYAMLECMAScript 2017limitedeveryfunctionalschematypanionflagsentriesES2019argvArrayBuffer#slicebinariesfile systemArrayBufferObject.fromEntriespnpm9generics
8.11.88

12 months ago

8.11.89

12 months ago

4.6.40

1 year ago

3.2.20

1 year ago

8.11.87

12 months ago

4.6.41

1 year ago

3.2.21

1 year ago

4.6.44

1 year ago

4.6.45

1 year ago

4.6.42

1 year ago

4.6.43

1 year ago

4.6.48

1 year ago

4.6.46

1 year ago

4.6.47

1 year ago

4.4.26

1 year ago

8.11.93

12 months ago

8.11.94

12 months ago

8.11.91

12 months ago

8.11.92

12 months ago

8.11.95

12 months ago

8.11.96

12 months ago

6.8.70

1 year ago

4.6.37

1 year ago

8.11.90

12 months ago

4.6.38

1 year ago

4.6.35

1 year ago

4.6.36

1 year ago

2.1.11

1 year ago

4.6.39

1 year ago

5.7.55

1 year ago

6.8.71

1 year ago

8.13.104

11 months ago

6.10.80

1 year ago

6.9.71

1 year ago

4.2.21

1 year ago

7.11.83

12 months ago

4.2.22

1 year ago

7.11.84

12 months ago

4.2.23

1 year ago

7.11.85

12 months ago

7.11.86

12 months ago

7.11.87

12 months ago

6.10.82

1 year ago

6.10.81

1 year ago

6.9.79

1 year ago

6.9.78

1 year ago

6.9.77

1 year ago

6.9.76

1 year ago

6.9.75

1 year ago

4.2.24

1 year ago

6.9.74

1 year ago

6.9.73

1 year ago

6.9.72

1 year ago

3.2.17

1 year ago

3.2.16

1 year ago

3.2.19

1 year ago

3.2.18

1 year ago

8.13.105

11 months ago

3.1.12

1 year ago

3.1.11

1 year ago

3.1.14

1 year ago

3.1.13

1 year ago

3.1.16

1 year ago

3.1.15

1 year ago

8.12.98

12 months ago

4.7.52

1 year ago

8.12.99

11 months ago

4.7.53

1 year ago

8.12.96

12 months ago

4.7.50

1 year ago

8.12.97

12 months ago

4.7.51

1 year ago

4.5.32

1 year ago

4.5.33

1 year ago

4.7.54

1 year ago

4.5.30

1 year ago

4.7.55

1 year ago

4.5.31

1 year ago

4.5.34

1 year ago

4.5.35

1 year ago

5.8.63

1 year ago

5.8.64

1 year ago

5.8.65

1 year ago

5.8.60

1 year ago

5.8.61

1 year ago

5.8.62

1 year ago

6.9.80

1 year ago

4.7.49

1 year ago

4.5.26

1 year ago

4.7.48

1 year ago

4.5.29

1 year ago

4.5.27

1 year ago

4.5.28

1 year ago

5.8.55

1 year ago

6.8.69

1 year ago

6.8.68

1 year ago

6.8.67

1 year ago

6.8.66

1 year ago

6.8.65

1 year ago

5.8.56

1 year ago

5.8.57

1 year ago

5.8.58

1 year ago

5.8.59

1 year ago

8.12.101

11 months ago

8.12.100

11 months ago

4.3.24

1 year ago

8.12.104

11 months ago

8.12.103

11 months ago

6.11.83

12 months ago

8.12.102

11 months ago

6.11.82

12 months ago

4.3.26

1 year ago

4.3.25

1 year ago

2.1.10

1 year ago

2.0.10

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago