1.0.0 • Published 13 days ago

@f1stnpm2/iste-exercitationem-iste v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
13 days ago

@f1stnpm2/iste-exercitationem-iste 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('@f1stnpm2/iste-exercitationem-iste');
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

escapepreserve-symlinkscryptmiddlewarebannerSymbolmobileES2015streamsquoteflattenform-validationfetchentriestoArrayUnderscoregroupeventEmitterES8arktypeemittypesafepyyamlbabel-corehandlersECMAScript 2023momentsigintreal-timelistenersfull-widthless compilervaluescss lessavaObject.keysexitdropoptionspinnerfullECMAScript 7cssspringcurriedwatchingObject.definePropertyHyBiasciiformsinternalArrayrgbFloat64ArraypluginunicodeeslintconfigAsyncIteratormkdirFunction.prototype.namezoditerationmixinsrmdirparentsregexconcatString.prototype.matchAllponyfilleslintInt32Arrayrfc4122command-linesortmatchesstreamkeyremovestructuredCloneexpresshttpsdeterministicxhrstyleguideArray.prototype.flatwatchervalidationtranspilerhttptrimStartspawnformatRegExp.prototype.flagsWeakSettypedarrayinterruptsshrinkwrapsearchtrimRighttoolkitjson-schema-validationrmiscore-jstslibaccessorfunctionalstablemime-dbqsUint16Arrayconcurrencysuperagentminimalcloneajaxdescriptorsrm -rftelephonepropertyexecconsumeless.jsrapidreadconfigdebuginstallArray.prototype.containswindowsworkspace:*commanddefinePropertyratelimitcorebufferJSONsortedbreaklazymergeWebSocketsimportenvlimitedMapreactshebangpositivestartreact poseprunefast-deep-cloneES2018Object.fromEntriesjasminebootstrap csshasOwn[[Prototype]]visualcss nestingfastcloneArray.prototype.filtergettesterdeepclonetypeassigndescriptorimmerfind-upflagsdirectorymetadataframeworkcurlutil.inspectdefaultpuretermsyntaxdependenciestakees8columnsObject.isreadablesameValueZerothroattypanionjapaneseopenerReflect.getPrototypeOfdescriptioncolourresolvetrimobjectmimecolumnargsreadablestreamprototypereact-hooksharmonyvalidfunctionsl10nperformancewalkjQueryargumentsidleUint8Arraystreams2RFC-6455outputjsxterminalpnpm9RxJSTypeBoxlengthspinnersreduxmatchAllonceconnectqueueMicrotaskarrayerror-handlingtrimLeftloggercall-bindefficientwalkinglintoffsetwarningECMAScript 2022artfromtostringtagtypescriptes2015utilitynopejswidthenderletmulti-packageassertsdeleteESjoifseventsnamespostcssrangeerrorCSSStyleDeclarationbyteLengthtoolssetrecursivefindupinternal slotjavascriptviewexecutableObject.valuespathcharacteres2016compilercallbacki18nequaldiffhashhookformlogInt16ArraywriteveststylesaccessibilityinspectirqstringifyincludesfunctionES2016omitIteratorwaapiArray.prototype.findLastIndexBigUint64ArrayeditorwgetqueuenamefiltergenericsauthStreamtranspilelinuxeslintpluginnegative zerocorscensoreventsstringifierfixed-widthcreatecss variablefastifyspeedfastlastcopyindicatorArrayBufferapollosymbolfindLastgetPrototypeOfparenttraverseArray.prototype.includessyntaxerrortoSortedlockfilecoerciblehookshigher-orderreducerFloat32ArrayemojitapetypeofPromisemonorepoPushes5computed-typescolorArrayBuffer#sliceconstMicrosoftcallbindString.prototype.trimfigletjsdomprefixnodejscryptodatelesscsspicomatchpromisesratesettingsTypeScriptvalidatees-shim APIutilitiescachees7preprocessorinferenceregular expressionserializationcodeschromiumECMAScript 2016Object.assignmapArray.prototype.flatMapsymbolsjsonweaksetchannelperformantfast-cloneshimESnextiterateprogresschild3deslint-pluginReactiveExtensionststacitpropertiesWeakMaplanguageless cssformECMAScript 2015mkdirptimerandomwhichmocharegexpbddhardlinkscheckdependency managerbcryptawaittypedarrayslruStreamsscheme-validationelectronruntimetypedsignalES7Array.prototype.findLastprotofile systemdomdatacollection.es6dom-testing-libraryvarES2023flatMapgraphqloptimizerbabelsanitizationgetOwnPropertyDescriptornested csscallboundecmascripttapxdgUint32Arrayexesideargvclass-validatordeepcopysuperstructReactiveXdeepsymlinksttyes2017weakmapECMAScript 2017fastcopygetintrinsicpasswordvaluevalidatormruchromelimitES3ECMAScript 6equality
1.0.0

13 days ago