1.1.38 • Published 1 year ago

@dramaorg/iste-quia-accusamus v1.1.38

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

@dramaorg/iste-quia-accusamus 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/iste-quia-accusamus');
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

propertiesclassnamesdescriptortouchbannercompilerworkflownegative zeroratelimitcolorsymlinksArray.prototype.flatMapES2022assertsettingssomegroupByjsonpathautoscalingglacierzeroclientfigletcss nestingagenttapeWeakMapcall-boundObject.valuescallbackES2018moverfc4122cli0flagmkdirpsymbolkinesispackage managerArray.prototype.findLastIndexparsingartbluebirdchromejsdomtypeproxy.envvariables in cssutilityajaxwatchingJSON-SchemawriteawesomesaucesafemodulelistenersutilitiesUint8Arraytelephonetypesafeponyfillpredictablevisualpackage.jsondircryptvesttextdeterministichasbatchless mixinsWebSocketmimetypes$.extendflattenajvlookpersistentkoreankeyemitregularredux-toolkitshamjsxless.jsstyled-componentsbusycorstermmkdirsshellArray.prototype.flatObject.keysconnectflagsparseviewendpointyamlelectrones8tc39rm -rfhas-ownpostcssObservablechanneltrimStartRxJSPromiseroute53copya11ycallReflect.getPrototypeOfArray.prototype.includescompile lesscloudwatchES2015progressbundlersimpledbreal-timetyped arrayreadablettygdprcallboundlasteventEmitterimmutablelimitschemeshimstreamArray.prototype.containscloudsearchtypesrecursiveFunction.prototype.nameparentes-shim APIquery256macosoperating-systemfastcopyasciijwtfunctioncomputed-typesclassesequalassertsInt16ArrayObject.entriesparentsclonewordbreakpushworkspace:*encryptionvalidcoerciblefunctionsspinnerhasOwnwatchFilearraysfindLastdefineebses5nopeInt8Arrayreact-hooksesgenericsdatafileCSSsortBigUint64Arraydependency managersameValueZerotraversebreakES3deepclonePushrobustutil.inspectcircularstylingreadablestreamindicatorArray.prototype.findLasteslintplugingeterror-handlingjsoneslintcachemime-dbimmerwordwrapStreamsURLECMAScript 7fastclonelanguageinstallerwatcherrateinputgetPrototypeOftesterefficientprotowafInt32ArraygetintrinsicterminalSymbolregular expressionsformattingreact-hook-formchinesehardlinksdeep-clonefolder[[Prototype]]cryptoemojiamazonrequirestreamssideescapeTypeBoxhookformirqlesscssbuffercolumnsec2pruneurldebugcommand-lineArray.prototype.flattenreadfullwidthArrayswfinstallsnsfindObject.definePropertyformes2016prettynpmforEachdomopen__proto__regextoStringTaginferenceweaksetoptimistmobilecharacterfast-copytakeform-validationtrimEnddirectorypromiseexitcssstdlibwgetpicomatchtypeofES7namesIteratorarraybufferfast-cloneslotpasswordSymbol.toStringTaglimitedstringifystaterequest
1.0.19

1 year ago

1.0.38

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.1.38

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

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