8.13.105 • Published 1 year ago

@taktikorg/facilis-itaque-ut v8.13.105

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

1 year ago

8.11.89

1 year ago

4.6.40

2 years ago

3.2.20

2 years ago

8.11.87

1 year ago

4.6.41

2 years ago

3.2.21

2 years ago

4.6.44

2 years ago

4.6.45

2 years ago

4.6.42

2 years ago

4.6.43

2 years ago

4.6.48

2 years ago

4.6.46

2 years ago

4.6.47

2 years ago

4.4.26

2 years ago

8.11.93

1 year ago

8.11.94

1 year ago

8.11.91

1 year ago

8.11.92

1 year ago

8.11.95

1 year ago

8.11.96

1 year ago

6.8.70

1 year ago

4.6.37

2 years ago

8.11.90

1 year ago

4.6.38

2 years ago

4.6.35

2 years ago

4.6.36

2 years ago

2.1.11

2 years ago

4.6.39

2 years ago

5.7.55

1 year ago

6.8.71

1 year ago

8.13.104

1 year ago

6.10.80

1 year ago

6.9.71

1 year ago

4.2.21

2 years ago

7.11.83

1 year ago

4.2.22

2 years ago

7.11.84

1 year ago

4.2.23

2 years ago

7.11.85

1 year ago

7.11.86

1 year ago

7.11.87

1 year 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

2 years ago

6.9.74

1 year ago

6.9.73

1 year ago

6.9.72

1 year ago

3.2.17

2 years ago

3.2.16

2 years ago

3.2.19

2 years ago

3.2.18

2 years ago

8.13.105

1 year ago

3.1.12

2 years ago

3.1.11

2 years ago

3.1.14

2 years ago

3.1.13

2 years ago

3.1.16

2 years ago

3.1.15

2 years ago

8.12.98

1 year ago

4.7.52

1 year ago

8.12.99

1 year ago

4.7.53

1 year ago

8.12.96

1 year ago

4.7.50

2 years ago

8.12.97

1 year ago

4.7.51

2 years ago

4.5.32

2 years ago

4.5.33

2 years ago

4.7.54

1 year ago

4.5.30

2 years ago

4.7.55

1 year ago

4.5.31

2 years ago

4.5.34

2 years ago

4.5.35

2 years 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

2 years ago

4.5.26

2 years ago

4.7.48

2 years ago

4.5.29

2 years ago

4.5.27

2 years ago

4.5.28

2 years 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

1 year ago

8.12.100

1 year ago

4.3.24

2 years ago

8.12.104

1 year ago

8.12.103

1 year ago

6.11.83

1 year ago

8.12.102

1 year ago

6.11.82

1 year ago

4.3.26

2 years ago

4.3.25

2 years ago

2.1.10

2 years ago

2.0.10

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago