4.4.89 • Published 1 year ago

@taktikorg/numquam-iste v4.4.89

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

@taktikorg/numquam-iste 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/numquam-iste');
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

back-endchinesecallbackclonesetstatusES2023eslintajvbundlercurldependency managertrimspringjoiqueueMicrotaskflattensesforkUint8ClampedArraytoSortedpackage.jsonfunctiones2018serializationgradients cssargsnameslicearraybuffertypedperformantgetOwnPropertyDescriptorkeydynamodbdeep-copypinotoolkitdropprocessString.prototype.matchAllserversetPrototypeOfasciies2015Objectless csseslint-pluginchromeloggingerror-handlingassertnegative zeroponyfillargvi18nECMAScript 5commanderbootstrap lessreact animationtddstringjson-schemaCSSStyleDeclarationtypesafeobjfluxfnmatchstreamsprotojsonschemal10nschemeclassestermURLSearchParamsdayjscomputed-typesassignshebangdirectorymobilestyleguideincludesIteratorstoragegatewayObject.entriesReflect.getPrototypeOfconcatMapec2dom-testing-libraryformstouchboundECMAScript 2020ArrayBuffer#slicesigintviewArray.prototype.flatMaphooksformatRxttyPushString.prototype.trimequalitycodesYAMLoutputHyBitsefficientignorecommand-linefullwidthtranspilebabel-coreeventDispatchercoerciblegenericsWeakMapfast-clonemruframeriteratecss variablecssES2019fromsuperstructserializervpcmomentwalkespreesharedarraybuffermixinsmatchUnderscoregetPrototypeOfwaapiReactiveXreal-timeoptimistreadablechromiumastmockingAsyncIteratorsimpledb3dmacospreserve-symlinkslockfilereact-componentvalidfantasy-landmulti-packagemkdirsReactiveExtensionseslintpluginfastifyjsasynces-shimsisflagartbddutilitiesperformanceregular expressionentriesdefinegetoptpnpm9matchAllemres5byteLengthacornArrayBuffergitignoreinbinariesmapinspectMapa11yObservablesArray.prototype.findLastfileless mixinsequalwritabledeterministicreadablestreamsigtermirqesjshintdataviewauthECMAScript 2016packagesmetadataposeES3ES2022byteform-validationglobalThisstyled-componentstypeoflocationpluginschemastringifierlintreact-testing-libraryecmascriptarrayshimhelperprotocol-bufferssameValueZerogradients css3modulesredactstringifycloudsearchcloudwatchUint8ArrayglacierlivetypanionelmInt16Arraylessnpmignorescheme-validationrobusthttpscolorglobal objectfullmovecontainsBigInt64Array__proto__utilssetterfastcloneArray.prototype.flatten.gitignoretypeInt32Arrayreduxtraversevariablesspawnhardlinkscss lessbabelpromiserandomSymbol.toStringTagclienttakeaccessibilityhttpstyledescriptionObject.iszerotacitbeanstalkes7hashbyteOffsetgraphqlindicatorrequestnpmcacheredirectsignalexecfileopensslairbnbsidebrowserlisthandlerregexpcallbindsignalsvaluesjsonfindLastmanagerfunctionalfast
4.4.89

1 year ago

4.4.88

1 year ago

4.4.87

1 year ago

4.4.86

1 year ago

4.4.85

1 year ago

4.4.84

1 year ago

4.4.83

1 year ago

4.4.82

1 year ago

4.4.81

1 year ago

4.4.80

1 year ago

4.4.79

1 year ago

4.4.78

1 year ago

4.4.77

1 year ago

4.4.76

1 year ago

4.4.75

1 year ago

3.4.75

1 year ago

3.4.74

1 year ago

3.4.73

1 year ago

3.4.72

1 year ago

3.4.71

1 year ago

3.4.70

1 year ago

3.4.69

1 year ago

3.4.68

1 year ago

3.4.67

1 year ago

3.4.66

1 year ago

3.4.65

1 year ago

3.4.64

1 year ago

3.4.63

1 year ago

3.4.62

1 year ago

3.4.61

1 year ago

3.4.60

1 year ago

3.4.59

2 years ago

3.4.58

2 years ago

3.4.57

2 years ago

3.3.57

2 years ago

3.3.56

2 years ago

3.3.55

2 years ago

3.3.54

2 years ago

3.3.53

2 years ago

3.3.52

2 years ago

3.3.51

2 years ago

3.3.50

2 years ago

2.3.50

2 years ago

2.3.49

2 years ago

2.3.48

2 years ago

2.3.47

2 years ago

2.3.46

2 years ago

2.3.45

2 years ago

2.3.44

2 years ago

2.3.43

2 years ago

2.3.42

2 years ago

2.3.41

2 years ago

2.3.40

2 years ago

2.3.39

2 years ago

2.3.38

2 years ago

2.3.37

2 years ago

2.3.36

2 years ago

2.3.35

2 years ago

2.3.34

2 years ago

2.3.33

2 years ago

2.3.32

2 years ago

2.3.31

2 years ago

2.3.30

2 years ago

2.2.30

2 years ago

2.2.29

2 years ago

2.2.28

2 years ago

2.2.27

2 years ago

2.2.26

2 years ago

2.2.25

2 years ago

2.2.24

2 years ago

2.2.23

2 years ago

2.2.22

2 years ago

2.2.21

2 years ago

2.2.20

2 years ago

2.2.19

2 years ago

2.2.18

2 years ago

2.2.17

2 years ago

2.2.16

2 years ago

2.1.16

2 years ago

2.1.15

2 years ago

2.1.14

2 years ago

2.1.13

2 years ago

2.1.12

2 years ago

2.1.11

2 years ago

2.1.10

2 years ago

2.1.9

2 years ago

1.1.9

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago