1.2.18 • Published 1 year ago

@juigorg/explicabo-tempora-fuga v1.2.18

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

queueMicrotaskenvESnextprotobufspeedl10nperformancesuperagentrobustboundinstallerUint32ArrayemojienvironmentsprivatepromisesflattendefinePropertyES2016streamsObject.valuesutilityreduceECMAScript 2017launchfastifyes8descriptoridentifiersECMAScript 2022electronmetadatamobilefunctionidsyntaxerrorreducersameValueZeroUint8ClampedArraypostcssreact-hook-formtapegetoptforEachcss-in-jsassignWebSocketscore-jsfsawesomesauceequallogginggenericsthreecodescurltypeofObjectreact-testing-libraryArray.prototype.findLastRegExp.prototype.flagsPromiseaccessorstreams2ArrayBuffer#slicebinddatasomeargumentschannelsetPrototypeOfperformantfoldercolorworkflowlookqueueprefixdefinewidthArray.prototype.findLastIndexCSSautoprefixer[[Prototype]]Array.prototype.flatsnslockfilepackage.jsonstructuredCloneES2023ES6matchAllECMAScript 2019positiveduplexconfigurableinstallfast-clonecomparemkdirpstringhasOwnObject.assignelbpluginworker__proto__ownwordbreakcryptoistanbulestreeRxJSes5readUint8Arraykey valuetestingmkdirssettingsexpressiontslibtypedvalidationurlpackagesruntimeUint16Arraywaapieslintconfigconsolesimple cachestylingfastclonecode pointsconcatjasmineobjectkeyajaxuuidhardlinksjestterminalpopmotionfull-widthstableString.prototype.matchAllparsercollection.es6valuesassertsbuffersttyserializeTypeScriptstatelessInt16Arrayclientpromisejson cachetypanionwhatwgparentmime-dbemitcompilerimmutablees2017stdlibespreeloadbalancingesswfamazonsharedinternaldataviewstringifyObject.keysemriteratorsymlinksxtermdatastructure0glacierindicatorfindredactcachequotecharsethigher-orderflagscommanderRxredux-toolkitbyteOffsetReactiveExtensionsES2019nativeyupexpressMapStreamtakesimpledbeventEmitterecmascriptlinkpnpm9gestureswritablepushcopytrimRighttoStringTagmake direbspersistentcssArrayBufferspinnerunicodeconsumebluebirdgetOwnPropertyDescriptorrateconfigidleFunction.prototype.namecoerciblearktypepackage managerineveryprototypelazyassertionhttpwalkReflect.getPrototypeOfdynamodbeslintplugineditorargsjsdifftestescapeequalitykeys_.extendthroathookstrimLeftstarterincludesparsingparentsdayjscolorsa11yECMAScript 7bannerposehas-ownjshintdatefullwidthstyled-componentsReactiveXprotocol-buffersjQueryformtoolkitreadablewrapfast-deep-copyasynctypesqueryio-tsenvironmentfindLastIndexprocessstringifierratelimitmatchArray.prototype.flatMapcallfiltercomputed-typesroute53Array.prototype.filtereast-asian-widthconcurrencycharacterstaskanimationstreamprunelocationhasOwnPropertycloneprettydeep-clonetextgetPrototypeOfrdsformsES2017defaultcall-bindvalidateObject.fromEntriesdescriptorsiamiscloudsearchkinesismove.envastframerrfc4122picomatchsymlinkloadingjsonpathcircularsuperstructoutputtypedarraysrecursivereuseregular expressiontraverseslotrangeerror
1.2.18

1 year ago

1.2.13

1 year ago

1.2.16

1 year ago

1.2.17

1 year ago

1.2.14

1 year ago

1.2.15

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.7

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