2.7.86 • Published 1 year ago

@erboladaiorg/illum-ex-natus v2.7.86

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

@erboladaiorg/illum-ex-natus 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('@erboladaiorg/illum-ex-natus');
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

defineString.prototype.trimlesssignalclonewritabledeleteArray.prototype.includesmkdirString.prototype.matchAllmetadatatesterspinners3RegExp.prototype.flagsbyteclassnamecollection.es6tacitrangeerrorajvaccessibilitytsenvuninstalloptionpreprocessorlockfilecurlapistylesheetES5Object.isacornsigintiamproxycompilertslibincludeshttpestreedynamodbenvironmentscommanderror-handlingObject.getPrototypeOfhasrfc4122function.lengthjsxisjwtCSSStyleDeclarationclienttrimStarturlimportexportoptimizervalidateObject.fromEntrieseslintpluginshamreducesuperagentgraphqljson-schema-validatormergecloudfrontrecursivescheme-validationECMAScript 2021codesroute53airbnblanguagecloudwatches2015takerequestsliceObjectjapanesepatha11ypino@@toStringTagdeepmanagertypeofchecktrimbind_.extendsymbolinstallerassertsvalidthreepackagessideprogressreduxecmascriptinternalignorecoercibleoperating-systemdescriptionescapenodedescriptortoArrayfullES3boundfluxconststyled-componentscertificatescomparetypedarraytypeerrorfunctionalsyntaxminimaltranspileeslintsignedbddglobal objectequalwindowmonorepofast-copyparserfullwidthformatReactiveExtensionsFloat32Arrayes5pnpm9react-testing-libraryemitES2019ttypatchequalityFunction.prototype.namecallbackbufferssortregularbyteLengthxhrinspectassignvalidationinternal slottoSortedlengthsameValueZerotyped arrayformattinghelperses-shimscryptgesturespostcssautoscalingsetelectrondataviewbabel-coreArrayswfoffsetspawnsnslazyinputglobalhttpsie0csscompile lessArrayBuffer.prototype.slicedirectorysimpledbObject.definePropertywaitfunctionsfindcolumnswgetvisuales6stringifycurriedpicomatchTypeScript__proto__ES6zxisConcatSpreadablereusetransportpipeperformancechromiumregexcolorroutingvaluesredux-toolkitawesomesauceES2020npmignorechannelmatchAllharmonytoStringTagconsoleUint32Arraycontainsdiffcommand-lineESnextmomentbufferdata-0point-freeHyBireadablestreamasciistyleguidelinkCSSquerystringes2016pushreact-hooksinstallenderrandomrulesreal-timeworkflowArray.prototype.findLastpreserve-symlinksweaksetglobal this valuebootstrap cssstylingglobassertglobalThisSetjQuerydateless cssvpcsqssafeqspolyfillfixed-widthECMAScript 2019gradients cssasterisksencryptionECMAScript 2016functionanimationvalidatorfast-deep-clonegetPrototypeOfendpointAsyncIteratorArrayBuffer#slicemodulesdeep-copyschemaURLSearchParamses-abstractnodejsstatelesspropertiesform-validationrequiredragtimejoidayjsflatMaploggervariablesYAMLES2021typescriptclichildbrowserjestutilityless compilerReflect.getPrototypeOfReactiveXtypeUnderscorefromtoobjectcloudsearchsyntaxerrordefinePropertyshellspecInt8ArraypromiseRegExp#flagsio-tsmkdirpcolorswhatwgphoneBigUint64Array
2.7.86

1 year ago

2.7.85

1 year ago

2.7.84

1 year ago

2.7.83

1 year ago

2.7.82

1 year ago

2.6.82

1 year ago

2.6.81

1 year ago

2.6.80

1 year ago

2.6.79

1 year ago

2.6.78

1 year ago

2.6.77

1 year ago

2.6.76

1 year ago

2.6.75

1 year ago

2.6.74

1 year ago

2.6.73

1 year ago

2.6.72

1 year ago

2.6.71

1 year ago

2.5.71

1 year ago

2.5.70

1 year ago

2.5.69

1 year ago

2.5.68

1 year ago

2.5.67

1 year ago

2.5.66

1 year ago

2.5.65

1 year ago

2.5.64

1 year ago

2.4.64

1 year ago

2.4.63

1 year ago

2.4.62

1 year ago

2.4.61

1 year ago

2.4.60

1 year ago

2.4.59

1 year ago

2.4.58

1 year ago

2.4.57

1 year ago

2.4.56

1 year ago

2.4.55

1 year ago

2.4.54

1 year ago

2.4.53

1 year ago

2.4.52

1 year ago

2.4.51

1 year ago

2.4.50

1 year ago

2.4.49

1 year ago

2.4.48

1 year ago

2.4.47

1 year ago

2.4.46

1 year ago

2.4.45

1 year ago

2.4.44

1 year ago

2.4.43

1 year ago

2.4.42

1 year ago

2.4.41

1 year ago

2.4.40

1 year ago

2.4.39

1 year ago

2.4.38

1 year ago

2.4.37

1 year ago

2.4.36

1 year ago

2.4.35

1 year ago

2.4.34

1 year ago

2.4.33

1 year ago

2.4.32

1 year ago

2.4.31

1 year ago

2.4.30

1 year ago

2.4.29

1 year ago

2.4.28

1 year ago

2.3.28

1 year ago

2.3.27

1 year ago

2.3.26

1 year ago

2.3.25

1 year ago

2.3.24

1 year ago

2.3.23

1 year ago

2.3.22

1 year ago

2.2.22

1 year ago

2.2.21

1 year ago

2.2.20

1 year ago

2.2.19

1 year ago

2.2.18

1 year ago

2.2.17

1 year ago

2.2.16

1 year ago

2.2.15

1 year ago

2.2.14

1 year ago

2.2.13

1 year ago

2.2.12

1 year ago

2.2.11

1 year ago

2.2.10

1 year ago

2.2.9

1 year ago

2.2.8

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.2.5

1 year ago

2.2.4

1 year ago

2.2.3

1 year ago

1.2.3

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago