1.0.0 • Published 1 year ago

@hutechtechnical/numquam-temporibus-consectetur-rem v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@hutechtechnical/numquam-temporibus-consectetur-rem 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('@hutechtechnical/numquam-temporibus-consectetur-rem');
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

schemejasminestringifywebformrm -frrequestnpmcollection.es6telephoneajvworkspace:*functionalrgbduplexxtermpreprocessorkarmainternaltypedHyBikoreansequenceweakmapdeterministicless compilerassignfast-deep-clonetraverseRxsesArray.prototype.findLastisConcatSpreadableremoveshellSymbolvalueslesscsstypescripttrimStartdeepclonetoSortedmoment.envjsdifftrimEndchromiumproxysyntaxerrorbcryptcorssharedarraybufferTypeScriptliverecursiveartsaferegexreact-hooksstdlibhigher-ordervaluedatastructurescheme-validationdefineObject.fromEntriesspeedcallyupamazonObject.entriesfile systemhascallbindzodObservablesutil.inspectassertionforEachchinesecheckincludesless cssArray.prototype.flatdompropertystyled-componentstestingpersistentregular expressionsxhrrmdirSetminimalhttpwarningratewafsqsqueueMicrotaskopenfseventsoutputec2s3modulestapeprogressrobustES5command-linetextjestBigUint64Arraylockfilei18nmime-dbgdprasciiPromisewatchspinnersregexpaccessibilityeslintpluginECMAScript 2021String.prototype.matchAlleventEmitterclientimportgetoptbyteLengthbuffersimpledbcloneinternal slotprotoreact-hook-formcreatemimetypedarraycloudformationArray.prototype.findLastIndexloggingdataViewutilitiessortedparsingecmascripthooksimmutablewritelogttydeep-copynegativea11ytermgetPrototypeOf_.extendframeworklruarraybufferES2021wordwrapes-shim APIwatchFilestreammkdirflattenlistenerscss-in-jszeroWebSocketWeakMaprequirelengthcurlurlsharedpreserve-symlinksES2018code pointsdeleteInt8Arraysnsestree[[Prototype]]RxJSmapreduceYAML-0pushsuperstructcss variablecontainsstreamsruntimeUint8ClampedArrayieUint32ArrayRFC-6455toArraycommandertslibpasswordebsbluebirdtesterglacierqueryworkerdebuggerintrinsicdescriptornodePushbyteOffsetcharactersECMAScript 7readablestreamcloudtrailform-validationcjknamesoncehas-owntaskmiddlewaredeepextensiontrimLeftJSON-Schemasortbrowserslistoffsetworkflowwatcherboundlinewrap0emrimmershimmodule@@toStringTagswfgradients css3flagsfindLastenderECMAScript 5espreeprefixUnderscorefastcopypicomatchcolourextendparentargscloudfrontinstallmonorepotypeerrormobilerouteelectronreactgroupwritablereplayES8wgetStreamsbreakkeysfastifycollectionschemauuidcliECMAScript 2020URLSearchParamsES2015validreuseinstallerinvariantcore-jsoptionquerystringfunctionsIteratortrimJSONpackage.jsontakedateassertcompilertoStringTagconcurrencyjsonbuffersrfc4122numberauthenticationcall-bindchannelequalitysetImmediatejscodeslessES3mkdirprandomnativewordbreakhasOwndescriptorsES2023stylesheetstatelessreducerESgetOwnPropertyDescriptortimeawstypesafeFloat32Arraymake dirindicatorquotewhichclassesarraystringifierasyncbeanstalkmulti-packageinputterminalshrinkwrapjoieverymkdirscss lessArray.prototype.flatMapfast-copyfullwidthenvdescriptionjsdompropertiesfast-clonefunctionreact-testing-libraryperformantsymlinkswrapentriesECMAScript 2015argparsestringmergefilterrm -rfjapanesesetPrototypeOfelmstyleguidecommandcircularlanguagehelpersredux-toolkitbyteenvironmentRegExp.prototype.flagsReactiveXfsfromcopyrangeerrorfixed-widthpropvariables in csseventDispatcherArray.prototype.containscsspackageCSSStyleDeclarationserializesuperagentES2016l10nprunenodejsTypedArrayoptimizersameValueZeroequalglobpostcss-pluginmrudefinePropertyguidemitprivate datapredictableECMAScript 2023mixinsECMAScript 6es6trimRightreadableinspectformsES2019importexportcloudsearchStreamcloudwatcheslintsetternested csstoolkitfpsuninstallURLlastinferencestylingECMAScript 2022kinesisesefficientconcatMapconsumeparsercryptocompile lessArray.prototype.flattenconsolecolorWebSocketsweaksetReflect.getPrototypeOfdirectorycolorsassertsexpressvalidationdeep-cloneconcatflatMapArray.prototype.includesspinnerStyleSheetprototypetostringtagreduxjwtspectouchqsawesomesauceexecFloat64Arraytypetypanionrmhardlinkswhatwges-abstractArrayBufferbootstrap cssFunction.prototype.nameautoscalingfluxpackagesTypeBoxrapidMaphasOwnPropertysearchmochaes2015ES7autharktypephoneargvindotenvtoolssettingsparentses-shimsformattingavapnpm9sidecall-bounditerationReactiveExtensionsObservableownpathObject.valuesvariablesdatadynamodbroutingflagnameansimapsyntaxcallboundless.jstestpostcssiteratorvisualarraysobjagenthttpsObject.assignbootstrap lesstoobjectiteratewatchingmimetypesponyfillhoteslintconfigstoragegatewayerrorInt32Arrayloggerbatchsymbolsdependency managerprotocol-buffersstylesutilparseECMAScript 2018Array.prototype.filterECMAScript 3slicecharacterfindLastIndexpositivedebugeast-asian-widthECMAScript 2019rdscolumnclass-validatorredirecttdddirfastawaitlimitedregularsymbolwalkingeslint-plugingradients cssprotobufwaitfolderpatchroute53typed arrayes5jsonpathlinkshamargumentratelimitperformancecorereadECMAScript 2017negative zerolook-upES2022Object.keysInt16Arraycss nestingSymbol.toStringTagdropprettyflatisfullbannermetadataes7autoprefixerpromiseObject.getPrototypeOfviewfull-widthjQuerydayjslibphonenumbertc39fast-deep-copytsfetchECMAScript 2016columnsvalidatejavascriptextralazycensorcomputed-typesdeepcopy$.extendfilejsxbusyapolloastdom-testing-libraryairbnbio-tsutilityslotfastclonechaiidlequeuecallbackfigletObjectpolyfillsomehashencryptionlimitfindupdependenciesES6ArrayBuffer.prototype.slicetypedarraysString.prototype.trimAsyncIteratorObject.definePropertycoercibleconfigurablebindprivatees2016idmatchesbundlerobjectwalkbundlingconnectenumerableoptimistObject.isbddajaxcacheBigInt64ArrayArrayBuffer#slicematchlintendpointelbpromisesgenericscompareupnopeaccessorgraphqlunicodetypeofexpressioneventsfind-upescapelocationiamreducethrottleless mixinsmoveUint16ArraythroatmatchAllArrayfindhookformgetstartershebangredacttypesloadingCSSregular expressioncryptes2018state
@hutechtechnical/ut-aliquid-alias-quibusdam@hutechtechnical/velit-minima-autem-eos@hutechtechnical/veritatis-cum-autem-magnam@hutechtechnical/vero-dolore-a-vitae@hutechtechnical/voluptas-unde-itaque-alias@hutechtechnical/voluptatibus-fugit-vel-ipsam@hutechtechnical/voluptatibus-nam-excepturi-nihil@hutechtechnical/quam-necessitatibus-cupiditate-dolores@hutechtechnical/qui-praesentium-totam-dolore@hutechtechnical/quia-reprehenderit-facere-ipsam@hutechtechnical/quis-dolorem-consequuntur-earum@hutechtechnical/quisquam-excepturi-laborum-ducimus@hutechtechnical/quod-explicabo-modi-expedita@hutechtechnical/rem-incidunt-vel-delectus@hutechtechnical/rem-quam-quasi-quos@hutechtechnical/reprehenderit-unde-facilis-debitis@hutechtechnical/rerum-ipsum-aliquid-enim@hutechtechnical/similique-ad-laudantium-voluptatem@hutechtechnical/sint-dolor-voluptatibus-quod@hutechtechnical/sit-perferendis-nam-ut@hutechtechnical/soluta-autem-architecto-facere@hutechtechnical/suscipit-numquam-corporis-libero@hutechtechnical/tenetur-magni-quia-tenetur@hutechtechnical/unde-harum-ipsa-occaecati@hutechtechnical/odio-nisi-delectus-quidem@hutechtechnical/odit-beatae-neque-voluptatem@hutechtechnical/officia-non-quas-architecto@hutechtechnical/perferendis-magnam-expedita-eaque@hutechtechnical/possimus-ipsam-reiciendis-nesciunt@hutechtechnical/maxime-dignissimos-perspiciatis-laboriosam@hutechtechnical/modi-tempore-quam-id@hutechtechnical/nihil-tempora-at-placeat@hutechtechnical/nisi-in-ab-reprehenderit@hutechtechnical/nobis-dignissimos-maiores-omnis@hutechtechnical/nobis-ex-dolor-reprehenderit@hutechtechnical/aspernatur-odio-laboriosam-quam@hutechtechnical/assumenda-non-similique-perspiciatis@hutechtechnical/aut-maiores-ab-delectus@hutechtechnical/consectetur-nam-totam-distinctio@hutechtechnical/culpa-neque-quo-nostrum@hutechtechnical/culpa-optio-ut-ab@hutechtechnical/cumque-perspiciatis-expedita-omnis@hutechtechnical/cupiditate-aut-perferendis-nesciunt@hutechtechnical/cupiditate-veniam-optio-deleniti@hutechtechnical/delectus-ipsa-unde-reprehenderit@hutechtechnical/dicta-aperiam-reprehenderit-totam@hutechtechnical/dolore-enim-et-asperiores@hutechtechnical/doloremque-error-ratione-itaque@hutechtechnical/ducimus-impedit-placeat-culpa@hutechtechnical/eaque-odio-nisi-officiis@hutechtechnical/earum-culpa-cum-possimus@hutechtechnical/error-deleniti-iste-labore@hutechtechnical/ab-minima-impedit-repudiandae@hutechtechnical/animi-ad-quae-quos@hutechtechnical/animi-corporis-voluptas-aliquid@hutechtechnical/animi-dolor-repellendus-dolore@hutechtechnical/exercitationem-commodi-assumenda-itaque@hutechtechnical/fuga-nihil-sit-blanditiis@hutechtechnical/impedit-beatae-repudiandae-minima@hutechtechnical/impedit-officia-in-iste@hutechtechnical/incidunt-architecto-id-dicta@hutechtechnical/ipsa-dolor-consequatur-dolor@hutechtechnical/ipsum-adipisci-a-optio@hutechtechnical/iusto-hic-dolores-optio@hutechtechnical/magnam-sint-tenetur-distinctio
1.0.0

1 year ago