1.0.0 • Published 8 months ago

@landmineaknpm/laborum-veritatis-a v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@landmineaknpm/laborum-veritatis-a Version Badge

dependency status dev dependency status License Downloads

npm badge

Robustly get the length of a Typed Array, or false if it is not a Typed Array. Works cross-realm, in every engine, even if the length property is overridden.

Example

var typedArrayLength = require('@landmineaknpm/laborum-veritatis-a');
var assert = require('assert');

assert.equal(false, typedArrayLength(undefined));
assert.equal(false, typedArrayLength(null));
assert.equal(false, typedArrayLength(false));
assert.equal(false, typedArrayLength(true));
assert.equal(false, typedArrayLength([]));
assert.equal(false, typedArrayLength({}));
assert.equal(false, typedArrayLength(/a/g));
assert.equal(false, typedArrayLength(new RegExp('a', 'g')));
assert.equal(false, typedArrayLength(new Date()));
assert.equal(false, typedArrayLength(42));
assert.equal(false, typedArrayLength(NaN));
assert.equal(false, typedArrayLength(Infinity));
assert.equal(false, typedArrayLength(new Number(42)));
assert.equal(false, typedArrayLength('foo'));
assert.equal(false, typedArrayLength(Object('foo')));
assert.equal(false, typedArrayLength(function () {}));
assert.equal(false, typedArrayLength(function* () {}));
assert.equal(false, typedArrayLength(x => x * x));
assert.equal(false, typedArrayLength([]));

assert.equal(1, typedArrayLength(new Int8Array(1)));
assert.equal(2, typedArrayLength(new Uint8Array(2)));
assert.equal(3, typedArrayLength(new Uint8ClampedArray(3)));
assert.equal(4, typedArrayLength(new Int16Array(4)));
assert.equal(5, typedArrayLength(new Uint16Array(5)));
assert.equal(6, typedArrayLength(new Int32Array(6)));
assert.equal(7, typedArrayLength(new Uint32Array(7)));
assert.equal(8, typedArrayLength(new Float32Array(8)));
assert.equal(9, typedArrayLength(new Float64Array(9)));
assert.equal(10, typedArrayLength(new BigInt64Array(10)));
assert.equal(11, typedArrayLength(new BigUint64Array(11)));

Tests

Simply clone the repo, npm install, and run npm test

workerlazymodulesguiddroploggingweakmapObject.keysdataViewinferenceUint16Arrayxdg-openreal-timetestergenericsoutputregexoperating-systemURLSearchParamsiteratecompile lessfunctionECMAScript 5sometslibthreevalidatepersistentfindupinvariantarktypefseventsnodejsjson-schema-validatornodeString.prototype.matchAllsymbolsshamreactexecbcryptUnderscorecore-jslrucompareconstviewflat@@toStringTagruntimefindLastArray.prototype.findLastIndexeventEmittereslintplugintypesbundlerpackage.jsonconcatMapcallbindwatcherlaunchrandomArray.prototype.containsduplexRxJSjsconcatwgettranspilegroupreducergraphqlhookformES6signalspopmotionclassnameECMAScript 2021terminspectsafedeepcopy0dom-testing-libraryESnextbyteOffsetjavascriptpasswordtostringtagintrinsicassignproparraypoint-freeserializationeslint-plugindatascheme-validationwaapinativegroupByeslintBigUint64Arraybannerposemkdirspackage managerBigInt64ArraytoArrayObject.iscss variableemitfixed-widthStreamsrapidreadrequestoptionsearchstructuredCloneArray.prototype.flattenlesscssflattenopenerawaitutilityshrinkwraptestingcollection.es6rmdirframeworkStreamnpm$.extendcompilerresolveArrayBufferpatchspecprotobuflockfileforEachgetterArray.prototype.findLastfunctionsprotocallclonestarterfsoffsetPushaccessibilityfast-copyparenttacitspringHyBiECMAScript 6a11ycollectionmonorepoirqreduxtraverse.envECMAScript 3argvbytereadablestreamfilterstyleguidel10nspinnerwatchinggetOwnPropertyDescriptordayjsES3statelesserror-handlingECMAScript 7validatorconnectiteratorECMAScript 2022variables in csswarninghasOwnjQueryrequireutilsjoiassertiondependenciesdescriptionflagbluebirdrmMicrosoftreuseserializejwttouchjson-schemacjkhigher-ordergestures6to5ECMAScript 2018findexpressjsdomflagsreact-hook-formcall-boundslotObjectcryptlengthcontainsi18nxdgRegExp#flagsmergeimmerInt8ArraywidthbrowserlistanimationcoloursettersetPrototypeOfmacosconfigcolumnsparserstringifierupxhrsuperstructcharacternameclientES8slicedescriptorscheckquerystringdefineasciicode pointstypedarraytypeiegetPrototypeOfPromiseargumentsclassnamesconfigurablestyled-componentsSymbolObservablesnegativedebugdependency manager[[Prototype]]look-upES2023dotenvperformantregexpform-validationautoprefixermime-dbponyfillprivatepreserve-symlinkshelpersvisualurlsconcurrencyapollotextArrayBuffer.prototype.slicekeytc39esgradients css3typeerrorequallimitedlintpostcsscensorcurlES7es2015childbufferfull-widthboundindicatorURLpureArrayeast-asian-widthencryptioninternal slotgradients cssregular expressionlistenersJSONwalkvalidationxssthroatECMAScript 2019react-testing-libraryterminalmapmulti-packageuninstallincludesrobustvestdescriptormatchesjestmkdirpcallbackextensionsameValueZeroexitequalityrecursivetrimStartECMAScript 2015typanionfast-deep-clonewalkingomitECMAScript 2017corswhichemojiES5isConcatSpreadablettyfastTypeScriptassertwritableextendnameswindowstrimLeftfiglettypescriptbrowserslisttoStringTagisFloat64ArrayframerdeepdeterministicmovehookstelephoneestreedirectoryspinnersJSON-SchemaminimalnumberRxpropertynested cssmiddlewareredacttoobjectutilitiesrm -rfenvcomputed-typeshttpsObject.valuesdefaulttestES2019typesafeurlramdaes2016arraysreadableajaxYAMLchannelquotehashsetImmediateUint8ArrayWeakMaptapebootstrap cssmochapluginfastifyunicodeReactiveExtensionses5electronlastWebSocketFloat32ArrayArray.prototype.includesonceaccessorcssperformancees2017regular expressionsnopeimportstylingSettakesymlinkslinuxapityped arraybabel-corefantasy-landcommand-linedeep-cloneavainternalajvvaluecircularprotocol-buffersIteratorsymlinkbootstrap lesswhatwgTypedArrayhttperrorasyncargparseRFC-6455stylesObject.getPrototypeOfbindxtermFunction.prototype.namehasstringdefinePropertybusypackagezodglobjasmineidletranspilerqueuesetfullwidthchaiexedatastructureArrayBuffer#slicespawncharactersdifffpmake dirsanitizenegative zerothrottledatelinewrapclass-validatortrimformattinglinkprunees-shim APIshimpolyfilltoolkitchinesetypedarraysstreamsflatMappositiveschemainstallerfolderESTypeBoxoptimizerbatch256entrieswaitcallboundtimeprefixsigtermsortedyupjapanesedeletelanguageReflect.getPrototypeOfvalidhandlersfilecommanderECMAScript 2020Int16Arraymomentpostcss-plugines8ES2021util.inspectauthenticationtypeofArray.prototype.flatObservablecacheregularartharmonyStyleSheetsignalwebsiteconsolewordbreakRegExp.prototype.flagschromiumletprototypefast-clonestreamexecutabledeepcloneefficientrgbratezeropnpm9CSSyamlmimestringifyio-ts__proto__ECMAScript 2023settingsoptimistmakemoduleschemeArray.prototype.flatMapCSSStyleDeclarationwatches7jsdiffwrapdebuggercommandsharedremoveweaksetpushsequenceqsawesomesaucestatusastworkspace:*inputcolorsprogressgetgetintrinsicwritesharedarraybufferArray.prototype.filterprettyarraybuffercoerciblesortenvironmentdomlibphonenumberreducepromisekeysrfc4122loadingloggereventschromees6react animation-0argumentairbnbtsformates-shimsweblessparseformsgetopttypedobjInt32Arrayiterationappextracolumndeep-copyES2018user-streamsopensmatchAllkarmatddcss-in-jslimitwordwrapstylefastcopyconsumeUint32Arrayrm -frqueryrangeerrorcopyvarstreams2immutablewatchFileescapelookuuidbuffersmrusymbolmatchserializerphonejsxformendereslintconfigassertscolorless.jsReactiveXecmascriptshebangcodesWeakSetbyteLengthgdprsuperagentsanitizationtapkoreanopenstableUint8ClampedArrayObject.definePropertyobjecttoSortedpropertieseveryES2016jsonschemabddmimetypesidpackagesloghardlinksparents_.extendbabelfetchpromisescss nestingfindLastIndexprivate dataratelimiteventDispatcherObject.assignredux-toolkitcoretaskfile systemreact-hooksECMAScript 2016json-schema-validationObject.entriesES2020cmdexit-codeWebSocketsstartinstallfromfast-deep-copymobileES2017variablesinterruptsString.prototype.trimbrowseres2018clicreateSymbol.toStringTagsigintauthsideargssyntaxerrorcall-bindclassesjsonpathmkdirtrimEndeditorpreprocessortoolsfastclonedataviewmixinsAsyncIteratorless csscss lesstrimRightspeedpyyamlES2015react poseutildragjsonfullqueueMicrotaskshellprocessObject.fromEntriessyntaxstylesheetmetadata
1.0.0

8 months ago