1.1.16 • Published 1 year ago

@dramaorg/eum-quisquam v1.1.16

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

@dramaorg/eum-quisquam 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('@dramaorg/eum-quisquam');
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

ECMAScript 2017rulescloudformationObject.fromEntriesstabledeepcopysescall-boundresolveformzerocomputed-typesfast-copycommanderprotocol-buffersnumbercolourbyteLengthpackage managerpreprocessorqshasformatisbabelurltypesreverseeslinttoStringTagdirvalidatepluginfast-deep-clonerfc4122a11yObject.definePropertyidentifierstypesafezxworkflowcommandgenericsparsereadcharacternopecompilerjsinECMAScript 2022queryinferencefullentriescloudsearchreworkimmutablegetoptReactiveExtensionsObject.keysidleharmonyprivatesymbolsgrouphooksthreeanimationuser-streamsflagsforEachkarmafast-cloneprefixrequestarktypeistanbulString.prototype.trimtsvariableswhatwgRegExp.prototype.flagsjavascriptshellrapidhttpswriteredirectconsumeapollolocalStreamsutilglacierestreevpcoffsetastletdotenvwidthbrowserlistchanneloptimizerfilefunctionalairbnbrsssafesettingswgetspringglobcjkObservablesES2016bddtacitlook-upguidlastslotspeediteratefunction.lengthvalueschineseartfs_.extend-0superstructfast-deep-copyinvariantcloudtrailcoercible[[Prototype]]regularproxyarrayslocationparentsshamsyntaxerrorflatvalueequalityrestfulmrulanguageloadbalancingArrayclassesmapESdeepmetadataregexpemri18nmanipulationzodgesturescallbacktesterkinesisschemapnpm9Float32ArrayvestjsdiffcreateMicrosoftposeexecfilepostcss-pluginmkdirpassignio-tsECMAScriptsharedimportexportdependency managerponyfillredux-toolkitdomsimpledbaccessibilityhardlinkspopmotionkoreanspeckeyES2018typedarraysmake dirObject.getPrototypeOfbusyspinnersbufferenderconfigsetImmediatemobileasyncwarningdirectoryECMAScript 2015intrinsicxhrbyteOffsetchecksidespinnerpositivegetintrinsicweaksetpinotsliblogwindowflagES8equalhigher-ordernativecommand-lineomitPromisebundlerespreeconcatclientsymbolfindupfantasy-landJSON-SchemaInt8Arrayinspectfind-upfeedtddRFC-6455inputmkdirindicatorJSONrgbeffect-tsinternal slottrimEndArrayBufferWebSocketsviewasciisameValueZeroObject.isobjectmatchAllupsource mapremoveforkxtermdependenciesescapeutilitiesyamlprotobufcss-in-jsreact-testing-libraryjasmineassertiontrimLeftarraybuffersharedarraybufferECMAScript 2023Float64ArraytraverseiamawesomesaucestyleredactMapl10nuuidtapfpsrandomglobalThisparserwritableWeakMapoutputglobal this valuecirculartoReversed3dtyped arraycallboundReflect.getPrototypeOfpackage.jsoncoloriteratortoSortedes-shim APIpromisees2016regular expressionebsES3buffersconstObject.valuesloggingfastclonemomentelectronArray.prototype.findLastlockfileUnderscoresyntaxsuperagentfullwidthdeepclonesymlinkspicomatchdragfindvisualregular-expressioneslintconfigweakmapcloudwatchgraphqltransforms3cssvarsec2reduxscheme-validationfolderECMAScript 2019es6eslint-pluginprogressstringifyelbArrayBuffer#slicedynamodbstreamsES5daterm -rfhashjapanesecolorspoint-freemovejQuerysubprocessnegativetc39phoneslicereducersqsdataviewtapematchECMAScript 7ECMAScript 2020wafendpointmapreducehas-ownnameramdaWeakSetES6.gitignoreemojiCSSconcatMapjsonschemawalkinges-abstractreact-hook-formArray.prototype.flatMapsettestingfindLastbannerwhichassertboundoptimistlookjoiglobalscallbindbabel-coredescriptorargumentfromstreamrmgettersortfnmatchunicodecontainsbinarycollectionSystem.globalfixed-widthjson-schemaes7terminalReactiveXtoobjecttimecurriedmodulesES2021ajvjson-schema-validatormochawebnodemulti-packagespawnpushAsyncIteratorpostcssespropertieslruArray.prototype.flattenbyteapiglobal objectexecuteieRxtranspileInt32ArrayURLURLSearchParamsvalidsearchtextdeterministicagentArray.prototype.containsdebuggerasterisksconsoletestdeep-clonefetchsortedjson-schema-validationparentes8reduceinternalcore-jsperformanceserializerprotoECMAScript 2021$.extendTypeBoximmerelasticache__proto__validatoreveryswfStreamInt16Arraylinktoolsflattenrmdirlintyupautoscalinges2018function0debugcorerecursiveprototypecensorformsvarincludesdom-testing-librarylibphonenumberstructuredCloneArrayBuffer.prototype.slicehelpercollection.es6monorepostyleguidenegative zeroautoprefixererrormodulebrowserslistwaapiUint8ArraylistenerstypeerrorjsonES2015ES2017typeofhasOwnPropertyroute53getOwnPropertyDescriptorcloudfrontlengthawstermhasOwnqueueMicrotaskpolyfillPushenvironmentscolumngetttyframertypedArray.prototype.filterprunestoragegatewaywalkes5.envrouteUint32ArrayES2022requiredescriptorsfunctionstrimruntimemkdirsansiexecpackagedefinePropertyRxJSserializationutilsavaclassnamecall-bindnpmignoretouchbindecmascriptcompareenvironmentjshintes2017amazoninstallminimalString.prototype.matchAlltelephonetypanionignoreESnextES2023frameworkcolumnssometrimRightfindLastIndexsnscharactersdatarm -fremittoArrayrangeerrorrouterIteratorstarterES2020regular expressionspackagesmanagertransportRegExp#flagsdeletegroupByquoteSymbol.toStringTagclonereversed6to5args256stringsetPrototypeOfcryptoECMAScript 2016formattingpropsetterjsdomshebangconfigurablefigletcoverageYAMLeventDispatchereast-asian-widthfile systemstyleschildUint16ArrayObject.entriescacheshimextendBigInt64ArraydifftostringtagisConcatSpreadablebinajaxeventsreadablenodejsArray.prototype.includeseventEmitterloggerchromepathbundlingBigUint64ArrayTypedArraybeanstalkjsxTypeScriptinstallerECMAScript 2018appworkspace:*routingCSSStyleDeclarationutil.inspectrobustperformantshrinkwrapbrowserES7curlreactstylingsinatrapatchfpObservablematchesstyled-componentsenumerableECMAScript 3gdprfull-widthextramakeregexpipedroppropertydayjsreusefastvalidationfilterxmlefficientrdsqueueschemechromiumdefineStyleSheettypedarrayes-shimsgetPrototypeOfidArray.prototype.flatFunction.prototype.nameECMAScript 5codesreal-time
1.1.16

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

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