1.0.0 • Published 14 days ago

@diahkomalasarinpm/vero-reprehenderit-temporibus v1.0.0

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

equalitydropwebBigUint64ArrayrgbbundlingtoStringTagutilitieslesscssdependenciesArrayBuffer#sliceoptimistsharedarraybufferentrieswritablegroupBytc39trimLeftapireuseECMAScript 2017limitedmomenteslintplugingenericsprototypees6symbolslanguagenumberinputWeakSetworkspace:*point-freemkdirsresolveshebangdefineinstallelectronbabel-corejasmineESnextdataViewajvES2020getPrototypeOfmonorepobannerjsonnested cssdirectorytestoptionflatMappositiveartfetchclishrinkwrapES2015mimetypesredactless.jseventDispatcherreact-hook-formbundlerurlsObject.isdefinePropertyreducercontainschildmixins_.extendio-tsprefixES6corspostcsssetdeep-copysliceansiwatchingArrayBuffer.prototype.slicea11yextensionregexploghandlersdotenvES7workereditorstyleextendsharedbootstrap csshelpersupsuperagentECMAScript 6curriedlinewraptslibiterateECMAScript 2015mergenoperegular expressionhttpcollection[[Prototype]]zodnpmcheckzerointrinsicrfc4122TypedArraytouchArray.prototype.findLastIndexpackagessomejson-schemaWeakMapvestvariables in csslistenerspersistentruntimewaitmimenameawaitArrayBuffercolourponyfillfunctionsharmonybytewordbreak6to5styled-componentsconfigurablemkdirpmapcmdsetImmediateschemecompareconcurrencyTypeBoxnodejsAsyncIteratorflagscss lesstaskperformanceoutputdeep-clonerobustargparsecall-bindreducesearchdiffObject.entriesargumentshashES3sigtermspawncolorrapidopenapollofullwidthwidthasciiglobreact posegetOwnPropertyDescriptorECMAScript 2019datastructurechaijsonschemafseventspurewgethardlinksbuffersconcaterrortypedreact-hookswarningpostcss-plugingetoptpyyamlspinnersshimutiles7validatorECMAScript 2020dragsyntaxerrorformatmime-dbirqfixed-widthlibphonenumberexit-codeclass-validatorregular expressionsdeepcloneES2022wrapcharacterses-shimsinstallerduplexfast-deep-copysignaltesterformattingconnectArray.prototype.findLastparsehasqsutilsoncecompile lessframerbabelFunction.prototype.nameeveryletsameValueZero-0es-abstracttostringtagurlArray.prototype.containsencryptionmatchestrimStartpackageArray.prototype.flattenparentsstructuredCloneYAMLtypescomputed-typesassertionquerystringgetterperformantstringreact-testing-libraryURLbuffereslint-pluginyupFloat32ArraytypeboundclassnamesexitObject.assignvalidationlaunchECMAScript 2021protocol-bufferssortthrottlewalkphoneflattenstableavaArray.prototype.flatcryptoreadcss-in-jsvalidfastcallbinduninstallwaapiObject.getPrototypeOfcode pointssequencechromejson-schema-validatoropenerclassesmulti-packageyamlkeyslookterminaleast-asian-widthcallbacktoolkites-shim APIstylingcurlwebsiteerror-handlingtoArraystatelessECMAScript 3idleRxtraversecolorsinferenceauthtypesafetrimmodulereactgetintrinsicecmascriptpackage managerstringifierjsdiffloggerparentlintenumerable256censorsigintes2016prettySymbolString.prototype.matchAllcallboundsanitizationtypescriptformsjson-schema-validationvarframeworkwatcherredux-toolkitRFC-6455clonesyntaxequalfromconstcommandcachedom-testing-librarysafeparserexpressionstylesheetreal-timefast-cloneauthenticationMicrosoftRegExp.prototype.flagsconsoleES2019visualrangeerrorHyBigraphqlrequestcommanderInt8ArraytaputilitySymbol.toStringTagrequirewindowsxdgreduxthreekarmaes2015arraysJSONfindupArrayObject.valueswriteindicatorfastclonees8formcodesmatchAlldateshellcoercibleeslintconfigform-validationstyleguidepipefunctionalvalidatearrayoperating-systemhookformvalueswatchFilemrubusystatusspecpopmotiontypeerrorESassertsbatchless csspathlook-uppatchES8joifull-widthless mixinsObject.keysuuidstreams2promisetoobjectasynctrimEnddatatakemacosstylesstdlibsanitizefshigher-orderdescriptorsenvironmentkoreancore-jsnamesfantasy-landlastreact animationarktypeoffsetprivate datadependency managerassignfunctionstreamgradients cssWebSocketsdataviewtermregularString.prototype.trimtddinvariantcreatequeryemojirmcallMapcall-boundremoverm -rfweakmaptranspileECMAScript 2022fastifyInt16ArrayArray.prototype.includesrandomjsdomdomclientbrowserslistsettertextmetadataramdaUint8ClampedArraycharacterinternal slotUnderscoreshamajaxinterruptsconfigStreamsqueuextermUint8ArraywatchpreprocessorIteratorjwtratelimitenvposeweaksetmochafastcopyES20213dsortedUint32ArrayES2018filtermakedayjsES5linuxmatchfolderrmdirPushlimitmoveObject.fromEntriesomittypedarray@@toStringTaglengthtimeES2016PromiseECMAScript 5browserstreamsstringifyprotodeleteECMAScript 2023airbnbspinnerTypeScriptSetthroatisConcatSpreadablefptypeofmobilelinktoSortedserializerBigInt64Arraybootstrap lessargumentpicomatchsettingsdeepfigletReactiveXappdeterministicsymlinkobjcolumniterationreadablestreamwhichdireslintchromiumrecursivejavascriptprogressbreaksuperstructcopycss variablenodepnpm9pushsideReactiveExtensionsestreeECMAScript 2018wordwraprateargvregexloadingtestingchinesefind-upnativejsserializationpluginCSSStyleDeclarationschemaarraybuffertoolscolumnsspringtyped arraytapejapanesefast-deep-clonetrimRightfilefindLast.envawesomesaucedefaultspeedpropertiesexeenderstarterhttpsdescriptorStreamcss nestinglruobjectsymbolArray.prototype.filteranimationlazy__proto__iteratorECMAScript 2016WebSocketaccessorreadabledeepcopysymlinkspromisesbyteLengthviewquoteaccessibilitymkdirgroupbyteOffsetexpressdescriptioninternalUint16ArrayastflatgetpruneguidArray.prototype.flatMapjsonpathnegativesignalsfullisextral10nhasOwnes2017xssReflect.getPrototypeOffile systemescapewhatwgexecpasswordpreserve-symlinksObservablesloggingnegative zerocommand-linees2018modulestacitargscoreemitObservablejesthooksStyleSheetdebugwalkingeventEmitterbddautoprefixeroptimizerbcryptexecutabletranspilerprocesslessObjectes5package.jsonvaluecircularprotobufminimalunicodetypanionopensJSON-Schemapolyfillserializetschanneljsxi18nttycsskey
@crabas0npm/nihil-alias-sint@crabas0npm/voluptas-ad-vel@diahkomalasarinpm/a-quam-voluptas-qui@diahkomalasarinpm/ad-molestias-fugit-sunt@diahkomalasarinpm/animi-facere-velit-dolorum@diahkomalasarinpm/asperiores-accusantium-minus-quod@diahkomalasarinpm/blanditiis-ullam-a-fugiat@diahkomalasarinpm/consectetur-ad-repudiandae-delectus@diahkomalasarinpm/corporis-a-quam-distinctio@diahkomalasarinpm/corrupti-autem-optio-iure@diahkomalasarinpm/cumque-nesciunt-non-eos@diahkomalasarinpm/debitis-explicabo-sunt-enim@diahkomalasarinpm/debitis-quas-fuga-occaecati@diahkomalasarinpm/deserunt-cupiditate-quos-beatae@diahkomalasarinpm/dolorem-tempore-vitae-animi@diahkomalasarinpm/eveniet-velit-praesentium-dolorem@diahkomalasarinpm/harum-esse-officiis-magnam@diahkomalasarinpm/harum-nihil-exercitationem-delectus@diahkomalasarinpm/illum-molestias-accusantium-rem@diahkomalasarinpm/incidunt-repudiandae-expedita-eos@diahkomalasarinpm/iure-asperiores-perspiciatis-mollitia@diahkomalasarinpm/magnam-incidunt-error-sapiente@diahkomalasarinpm/nesciunt-expedita-rerum-cumque@diahkomalasarinpm/occaecati-incidunt-dolor-accusantium@diahkomalasarinpm/omnis-veritatis-asperiores-recusandae@diahkomalasarinpm/praesentium-accusamus-maiores-autem@diahkomalasarinpm/provident-eaque-consectetur-harum@diahkomalasarinpm/sapiente-quibusdam-repudiandae-eligendi@diahkomalasarinpm/tempora-iusto-voluptates-vero@diahkomalasarinpm/vero-reiciendis-asperiores-magnam@diahkomalasarinpm/voluptate-asperiores-voluptatum-accusantium@diahkomalasarinpm/voluptatem-illum-aperiam-dolores@ffras4vnpm/commodi-vero-assumenda
1.0.0

14 days ago