1.1.31 • Published 1 year ago

@juigorg/neque-necessitatibus-asperiores v1.1.31

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

@juigorg/neque-necessitatibus-asperiores 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('@juigorg/neque-necessitatibus-asperiores');
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

fpswritemapreduceES2020enumerabletypescriptpipelinuxcode pointsURLbrowserslistdependency managerjavascriptmiddlewarelinewrapplugintermpostcsszerofastproxybddspinnerstringifieriamclonelastratemomentstarterjsxReflect.getPrototypeOfhotoperating-systemdatabrowserlistpreprocessortrimEndresolvecolorslesscsses-abstractrangeerrorhigher-orderlengthhas-ownhardlinksESflagcheckpyyamlparserdebugcopybeanstalkstreamdotenvdynamodbstylesprototypecachecharacterFloat32Array256ReactiveExtensionsmimeECMAScript 7URLSearchParamsfindupECMAScript 2017accessorprotocol-buffersfindoffsetfunctionfromcloudsearchtrimRightsigint@@toStringTagmapsomebatchimportexporteventDispatchercollection.es6randomsimpledbfluxequaleast-asian-widthfast-deep-copystructuredCloneArrayBuffer#slicethroatstylesheettakees6call-bindhaspicomatchpropertiespackagedeletemodulegroupByboundoptionrouteslicestringifyUint32ArraydatastructurecallboundwatchFilearrayshooksfile systemvaluestc39prunedomiteratebootstrap lessECMAScript 5swfsymlinksroutingdependenciesmrulookjsdifftypedarrayslinknodeescapeeslint-plugintapprivatereadablestreamfind-upstatelessformsoptimizerWebSocketswordbreakstdlibwgetECMAScript 2018vestschemaMicrosoftfullwidthES5curlparentgetterwalkinges-shimssharedarraybufferCSSStyleDeclarationECMAScript 20160make dirargumentES2023ECMAScript 3inspectdeep-cloneeslintpluginintrinsiccloudformationfast-copyregexpfunctionsastassertextendFloat64ArrayInt32ArrayjsargssessuperagentES2021duplexconcatMapprefixnodejswidthsymbolframeworkmacosserializergenericsclass-validatorsettingsqueueruntimeasciiutilitiesio-tspropdatesignalsfastcopydescriptorsBigUint64ArrayPushurlObject.iscliless.jsdirectorylimitedvariableswebArray.prototype.includesimmutableES2022filterstatuswordwrapkeysrecursiveobjectpolyfillexectraversergbworkspace:*s3react-hookses2015sidesyntaxerrorequalityStreamfunctionalAsyncIteratorstreamshookformeslintweakmapcall-boundquoteinternal slotdiffcss lesstsArray.prototype.findLastgradients css3[[Prototype]]ownenderWebSocketpasswordutil.inspectshrinkwrapString.prototype.trimsafeformatchromeconsoleansimonorepoavajesteveryparsehttpsvariables in csslook-upidvpcclasseswafES6ajvrdsairbnbbootstrap cssstyleguidetypedarrayprogresscensorObservablesJSON-Schemamobiledataviewerror-handlingtouchmkdirpinzodRxutilityterminalless csselectrontrimStartargparsemovetddfull-widthqueueMicrotaskcss-in-jsawsconcurrencydebuggerspinnersdom-testing-librarysetwindowsBigInt64ArrayinstallECMAScript 2023es8validatevalidationtrimLeft__proto__immeruuidMapdataViewArray.prototype.filterObject.getPrototypeOfcodesapiprettydropwatchingloadbalancingObject.assignquerystringlesssortestreeslotwalkObject.keysemitcomputed-typescommandmakenumberreadableautoscalingforEachentriesfolderchaitypeerrorttysetImmediategetoptbundlermodulespathcssxtermmkdirgdprform-validationrequireshimESnextcore-jsstringarraybluebirdFunction.prototype.nameconfigurabletypesirqpackagesgraphqlArray.prototype.findLastIndexcharacterscompile lessstyle.envassignformpackage managercallvalidratelimitdefinePropertyhandlersmatches2016propertyvisualcomparemetadatatypedayjsiecolourshamspeedapollotaskbyteOffsetflatMap$.extendString.prototype.matchAlliteratordescriptiontyped arraynested cssdeterministicjsonpathemrTypedArraymatchAllloggerglacierWeakSetObject.definePropertydircommand-lineRegExp#flagsrm -rfi18npromisesecmascriptnpmObject.fromEntriesarraybufferutilcirculartypeofbannercommanderisES2015styled-componentsbyteLengthenvironmentenvsqsfast-deep-cloneiterationRxJSpackage.jsonsigtermmochatestingpushtslibesfseventspreserve-symlinksPromisevaluejasmineunicodefastifynegative zeroviewcontainsredactsortedcorecolumnrmglobsyntaxtoArrayES3callbinddeepless compilerjsonoutputworkflowtesterbrowserArray.prototype.containsloggingtelephonedeepcopyregular expressionkoreanrapidpnpm9openYAMLflattenisConcatSpreadableInt8Arraymatchesfetchassertionexpresses7libphonenumberwatcherReactiveXoptimistinternalencryptionECMAScript 2015Iteratorpatchmulti-packageECMAScript 6es2018stateartshellcoercibleArrayBuffer.prototype.sliceRegExp.prototype.flagsObject.valuesgroupmergegetOwnPropertyDescriptorcorsbuffersfullconcatcss variableupinstalleraccessibilityliveSymbol.toStringTagreusepersistentlruschemereactidlemkdirsES2016tostringtaglogsettercallbackjoithrottleextraeslintconfigconsumewraprfc4122omitchannelES7clientsameValueZerofindLastmixinses-shim APIsequencesetPrototypeOfimportextensionlimitdefineyamlformatting
1.1.29

1 year ago

1.1.28

1 year ago

1.1.30

1 year ago

1.1.31

1 year ago

1.1.19

1 year ago

1.1.18

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.27

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

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