6.6.85 • Published 1 year ago

@taktikorg/odit-similique v6.6.85

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

@taktikorg/odit-similique 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('@taktikorg/odit-similique');
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

global objectastrequestconcatfunctionfunctionsclientES7varslocalcircularapisymlinksECMAScript 2019fastcopybundlerstabletexttypeslesscsslruexecfileroutingmomentformattingdirectoryschemapolyfillinstallerdataViewhttpchromeincludesbinariesWebSocketreact posefpruntimemulti-packageenvironmentsesdatepackage managersqsArray.prototype.findLastIndextestWeakMapECMAScript 2023fast-deep-clonetacitredirectthreeESnextsymlinkspinnerRegExp#flagsmacoseventDispatchernamedefineassertionArrayBuffer#slice-0assertsmoduledotenvStreamserializationgetoptclass-validatorvarmatchAllfnmatchsharedarraybuffergitignoreajaxloadbalancingReactiveExtensionsconsoleECMAScript 2022execunicodeprivate3dlazyelectronwaitURLindicatorflatMapchromiumprototypeInt16Arraytypedreact-componentglobalURLSearchParamsnativeownmakeArray.prototype.containsrobustslotenv@@toStringTagwindowsagentconsumeworkspace:*RFC-6455urljsdomtrimRightcollectionmixinsstreamsdefinePropertyprotoworkerless mixinsTypedArraychineseexitcorecloudwatchidleregexphandlerspnpm9front-endES2023argsshellminimalnegative zeroconfigurableservicedomimmutablejwtMicrosoftjQuerysomebinnested cssshrinkwrapnpmignoretrimLeftreplaypositiveshimsortedespreeworkflowdescriptormatchmrujson-schema-validatortyped arrayglobal this valuefastifyhttpsES2022selfflattenschemereadablestreampromisestringifyYAMLvalidationignorepluginFloat32ArraycloudtrailfigletarraywritedirSymbolcoerciblesharedObservableobjcall-bound[[Prototype]]hasOwnPropertyio-tstoSortedprogresswgetprotobufcallbindfindhardlinksfetchcolorObject.definePropertyhooksglobalThishasOwncontainsdataless.jses2017full-widthisConcatSpreadablejsxcommanders3inmaputilsexit-codemake dirstringifiertimedragmkdirschannelphonerapidenderutilitiesprotocol-bufferselbObservableswindowenumerablecss nestingcss-in-jscolorsfindLastIndexletfunctionalnegativeseti18nArray.prototype.filterquoteECMAScript 2018equalityaccessorAsyncIteratortypeerroreventEmittercacheregexstreamencryptionexpressinternal slotObject.keyspasswordspinnerskeytrimdropdeepcopydeep-copytypescriptendpointtddspecnamesESwidthArrayBufferkoreancommandReflect.getPrototypeOf256fast-copystateIteratortslibrandomtrimEndcurlutilitycloudformationartcallawsestreezerosetPrototypeOfes2016iteratorbrowserslistclonepurevaluecommand-lineec2internaldeep-cloneviewbabel-corebrowserPromiseglobserializerObject.isECMAScript 2020ansilistenerstoolsmetadatahas-ownjoiconstECMAScript 6warningformsshebangBigUint64ArraystoragegatewaySeteventswhichgradients cssloadingECMAScript 2016speedcensorreducerpropfilematchesES6cloudsearchtypesafeSymbol.toStringTagArrayerrordom-testing-librarypackage.jsoneffect-tssignalsposetakejsdiffjestdependenciesnopearraybufferbinaryes6Object.valuesTypeBoxstyleescapeqses8setImmediateJSON-SchemasettingsObject.getPrototypeOfInt8Arrayprefixstylesgradients css3forEachredux-toolkitpropertyuploadpopmotiones-abstractfast-deep-copyparserpipechecknpmES2020deletetoolkitinputgenericsjsvisualbufferssigtermECMAScript 7diffbyteOffsetHyBivalidatorPushreadmobileserverpersistentObject.fromEntriesArray.prototype.findLasthelperentriesarktypeweaksetES2016readablestylingstatelessfile systemUnderscoreJSONxhrregular expressionpatchintrinsiciamjshintroutefunction.lengthhelperswhatwgglacierfindLastreact-testing-librarypoint-freereactvalidassignECMAScriptasterisksjavascriptdynamodbcompile lessUint8Arrayxtermforktranspileshamimmerimportsubprocessmergea11yes5.envhandlermockingstyleguidesortformatextendtypanionpostcss-pluginfiltersequencelivefluxsyntaxterminalarraysemitless compilerttybufferFloat64Arrayresolvedeterministichookformbootstrap csshotsettercss variablefullbundlingiterationmock__proto__route53querystringES2018callboundmodulesbcryptisclisameValueZeromkdirObjectdeepcloneeslint-pluginnumberBigInt64ArrayacornArray.prototype.includesdeepinstalllibphonenumberreusebusy6to5pyyamlebsbannerlintstarterequalponyfillutilreducechildeslinteast-asian-widthbrowserlistconfigbddscheme-validationprocesssesinspectremove$.extendirqFunction.prototype.namekinesisspringwritablewalkcloudfrontinvariantawesomesaucelengthuser-streamsextraprettymapreduceform-validationeverybabelyupenvironmentmovewaapivestprivate dataES8vpcreal-timeECMAScript 5yamlflagsamazonsidepicomatchsafeelasticacheiees-shim APIanimationramdasymbolsdescriptionrecursiveauthstatusdatastructureMapReactiveXcompileres7comparecall-bindemrObject.entrieserror-handlingjapaneseinterruptsvaluesRxJSmanagercolumnlastfast-clone
6.6.85

1 year ago

6.6.84

1 year ago

6.6.83

1 year ago

6.6.82

1 year ago

6.6.81

1 year ago

6.6.80

1 year ago

6.6.79

1 year ago

6.6.78

1 year ago

6.6.77

1 year ago

6.6.76

1 year ago

6.6.75

1 year ago

6.6.74

1 year ago

6.6.73

1 year ago

6.5.73

1 year ago

6.4.73

1 year ago

6.4.72

1 year ago

6.4.71

1 year ago

6.4.70

1 year ago

6.4.69

1 year ago

6.4.68

1 year ago

6.4.67

1 year ago

6.4.66

1 year ago

6.4.65

1 year ago

6.4.64

1 year ago

6.4.63

1 year ago

6.3.63

1 year ago

6.3.62

1 year ago

5.3.62

1 year ago

5.2.62

1 year ago

4.2.62

1 year ago

4.2.61

1 year ago

4.2.60

1 year ago

3.2.60

1 year ago

3.2.59

1 year ago

3.2.58

1 year ago

3.2.57

1 year ago

3.2.56

1 year ago

3.2.55

1 year ago

3.2.54

1 year ago

3.2.53

1 year ago

3.2.52

1 year ago

3.2.51

1 year ago

3.2.50

1 year ago

3.2.49

1 year ago

2.2.49

1 year ago

2.2.48

1 year ago

2.2.47

1 year ago

2.2.46

1 year ago

2.2.45

1 year ago

2.2.44

1 year ago

2.2.43

1 year ago

2.2.42

1 year ago

2.2.41

1 year ago

2.2.40

1 year ago

2.2.39

1 year ago

2.2.38

1 year ago

2.2.37

1 year ago

2.2.36

1 year ago

2.2.35

1 year ago

2.2.34

1 year ago

2.2.33

1 year ago

2.2.32

1 year ago

2.2.31

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

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