1.2.15 • Published 1 month ago

@kollorg/dolor-porro-harum v1.2.15

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

ES5streammetadataless compileryupprotodependency managerregulartoArraybatchlinkesbeanstalksearchebsregular expressiondeepcloneECMAScript 2015ECMAScript 2016call-binddescriptionnumberwaites2017ESnextstyleguideponyfillcrypttslibReflect.getPrototypeOfbootstrap cssmixinscurlES2023parsehttpnativeprotobufroutingcallbindmapreduceArray.prototype.findLastpruneES2021toolssettingslintqueueeast-asian-widthtrimeveryinstalljwttextObject.isfunctionalpipeURLreadablestreamforEachenvauthbluebirdcallfast-deep-copyUnderscoremime-dblastless mixinsserializetypedarrayshashawaitcompile lesscryptotelephonebannersesincludesa11ywritablefile systemcss nestingcharacterwatchFileclientes2018ttywgetencryptionfilterrequireendpointtrimLeftbrowserspinnersPromisecloudfrontfunctionphonepolyfillupmatchES2018assigneventstrimRightRFC-6455cachecss lessArray.prototype.includesclicolumnschromeextraunicodeawslocationless cssflatMaplesslruwalkinglibphonenumbernegative zerooffsetpathhaspreprocessorpnpm9.envwhichmake dirrobustwatchingreduceescapelistenerstrimEndECMAScript 2018datastructurexhrzodmiddlewaremruECMAScript 2017packagereact-hooksuuidentriesreusejsdifftestpromisenamesshebangTypedArrayutilityresolveSymbol.toStringTagRxJSoptioncolorrgbpropstylesURLSearchParamsnested cssomitStreamsutil.inspectcensorvariables in cssdayjsemrtypescriptdotenvconfigES2015symbolsstatenodejschineseguid-0fullremovefindLastIndexprotocol-buffersestreevisualarktypeidES6javascriptcallboundSetrm -rfBigInt64ArraycompilercloudwatchString.prototype.trimstringifyTypeBox256filewritestringconcatMapObservablestypeerrorlookvpcECMAScript 7hasOwnPropertyrequestprogressquerymkdirchannelCSSspecrmdirObject.fromEntriesshrinkwrapArrayBuffer#sliceenvironmentio-tsmomentmochabyteLengthMapbuffersECMAScript 2023clonepropertiestddcolorsFunction.prototype.namebcryptbddes-shim APIeslintreactcloudsearchrmopenrouteworkflowObjectflagsloadbalancingrecursivedom-testing-librarygradients cssownquoteobjnpmpicomatchkeysregexpmatchesarraybufferhardlinkspackage managerECMAScript 2019MicrosofthasOwnWeakMapimportexportbindfolderratelimitfastifyassertsHyBipostcssnodees-abstractObject.valuesasyncargparsetypedarraywalkfast-clonesequencetapeboundlook-upinESviewsetImmediateECMAScript 2020iteratetssliceclass-validatorYAMLcheckcall-boundkoreanJSONtypesafeObject.entriesdirectoryshamagentRegExp#flagspasswordimmutableaccessorreducerutilitiesarrayES3schemeoptimistbusyargumentcharactersfastclonecoremappropertyassertionargvserializationkinesispredictableinternal slotemitauthenticationObject.assignuninstallcorswatchvalidateintrinsicStyleSheetmkdirsdependenciesloggingvestnamepackage.jsonES8cloudtrailwordbreakfixed-widthprivate datawhatwggdprsortedsomecore-jssetterjsonpathgetoptmulti-packagefetches2016commanderquerystringInt16Arrayclassnamesrfc4122functionsObservableCSSStyleDeclarationbundlingenumerablestarterl10nsharedarraybufferbreakreplayreact-hook-formmonorepo_.extendlanguageasciithroatformattingreadabletaphelpersUint8ArrayRxchromiumexecprettychaistreams2codesequaltraversestructuredCloneinstallerfindLastperformantreact-testing-librarymimetypesWebSocketcomparerm -frnegativeInt8Arrayurlbrowsersliststablejsxtimeidleonceconsumeminimalgradients css3es2015toSortedworkerless.jsES2020optimizermkdirppreserve-symlinksjasmineAsyncIteratorpostcss-plugineventDispatcherwarningduplexsuperagentscheme-validationcopyimmerES2019importsymlink$.extendpersistentWeakSetdeepjsonjapaneseloadingmobilegetPrototypeOfisenderapiastredux-toolkitapollosuperstructconsolewrapBigUint64ArrayFloat32Arraycomputed-typesautoprefixerArray.prototype.filterTypeScriptdescriptoriecss variableproxywatcherdeepcopycode pointsECMAScript 3ajaxelectronxtermes6typedes5reduxArrayBufferaccessibilityframeworkdeterministicstreamsprivateStreamreadpromisesparsingdynamodbsafediffeslint-pluginglobsameValueZeroglacierfastrapidrandomformtypeprefixspeedecmascriptindicatordropmakeObject.getPrototypeOfajvES2022sqsamazoniammodulesRegExp.prototype.flagsflagfast-copymatchAllpositiveformsWebSocketsjoiES2017groupfigletdebuginputconnectgetterfullwidthtc39cssisConcatSpreadableflattengetOwnPropertyDescriptorelasticacheconcatcreatetakethrottleArray.prototype.flattenjsdomform-validationassertregexroute53expressionstylesheetpushdefinePropertyUint32ArraygraphqlpackagesES2016autoscalingtoStringTagbrowserlistString.prototype.matchAlltrimStartshareddatees-shimsratesloteventEmitterIteratorelbutilconcurrencyReactiveExtensionsstringifiercollectioncontainsArray.prototype.flatlimitcolumnstyled-componentsdeleteshimrangeerrordataViewairbnbcloudformationespreeextensionsyntaxloggerbyteOffsetmovefpsfromvalidflattypescommandi18nefficientArray.prototype.containsredirecthas-ownsnsjestbootstrap lessfastcopyqsbufferextendinspect[[Prototype]]statelessclassnametasklogUint8ClampedArrayarraysspinnerECMAScript 6Object.keysgetintrinsicArraygroupByArray.prototype.flatMapECMAScript 2021schemaavaUint16Arraytermlimitedcircularfast-deep-cloneexpresslazylesscssreal-timeweaksetArrayBuffer.prototype.slicehttpsobjectterminaldiransiqueueMicrotaskinferencelengthsymlinksawesomesaucenopees7typanionjsfseventstoobjecteslintpluginmergestdlibcolourfull-widthfscollection.es6regular expressionsiteratorequality__proto__PushrdssymbolfluxdataviewsetPrototypeOfweakmapReactiveXstylingmime0outputJSON-Schemasetdefine
1.2.15

1 month ago

1.1.12

1 month ago

1.2.14

1 month ago

1.1.14

1 month ago

1.1.13

1 month ago

1.1.11

1 month ago

1.1.10

1 month ago

1.1.9

1 month ago

1.1.8

1 month ago

1.1.7

2 months ago

1.1.6

2 months ago

1.1.5

2 months ago

1.1.4

2 months ago

1.1.3

2 months ago

1.0.2

2 months ago

1.0.3

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago