1.0.0 • Published 8 months ago

@ryniaubenpm2/pariatur-eius-distinctio v1.0.0

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

@ryniaubenpm2/pariatur-eius-distinctio Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Which kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without instanceof, and despite Symbol.toStringTag.

Example

var whichCollection = require('@ryniaubenpm2/pariatur-eius-distinctio');
var assert = require('assert');

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

assert.equal('Map', whichCollection(new Map()));
assert.equal('Set', whichCollection(new Set()));
assert.equal('WeakMap', whichCollection(new WeakMap()));
assert.equal('WeakSet', whichCollection(new WeakSet()));

Tests

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

zodSetregular expressionformatlinkdatastructurepersistentcss nestingfseventsasserts0promisesshell_.extendjwtinferenceES7emojiregulartakees5idES2023airbnbparsinges8setPrototypeOfboundguidcallbounddynamodbtestingtrimEndmodulesdomcheckviewyamlisbddtimeindicatorcloudsearchrdsbeanstalkUnderscorereactawaityupfullwidthloggingcloudwatchpicomatchprotobufmime-dbparseHyBiInt16ArraylogliveUint8ArraycjkeventEmitterlistenerskoreanmonorepoBigUint64Arraymake diriedeepclonebuffersjsonmatchnpmterminalfiltercommandfigletencryptionhttpgetterregular expressionsfluxPushObservablewafdom-testing-libraryobj__proto__toobjectauthenticationfilelrubannerStreammoduleFunction.prototype.nameform-validationcallbinddropaccessortrim@@toStringTagweakmaptoolkitES2021compareperformanceserializeoptimizerreact-testing-librarystablecachedeep-clonefastmatcheses2018eslintconfigprototypeAsyncIteratorappwhichES2017formattingquerystringhas-ownfunctionalarktypeES6restfulvalueRegExp#flagsECMAScript 3macosnested cssRFC-6455throatutil.inspectfastcopytelephonefindupwgetdefinesetcollection.es6stylingdeterministichotObject.keyscss variablesimpledbECMAScript 2016removeregexppathsidestreamscolumnsframeworkgroupsyntaxerrorECMAScript 2019ES2015mergeflagjsdomhashtapesigtermprivate datatypestrimLeftserializationtc39execfunctionsWebSocketmapiterateprivatelockfilevaluesoutputfind-upargparseES2020tsstructuredCloneUint32Arraydatecall-bindtypecharactersfindLastIndexless compilerArray.prototype.flattenJSON-Schemaerror-handlingproxywatcherpnpm9ReactiveExtensionsfastclonebytedependenciesURLSearchParamsworkspace:*inspectsesnamesargvconfigurles2015es2016RegExp.prototype.flagsbreakswferrordataViewbrowserhelpersdatatyped arrayloadingCSSutilityquerystdlibmakemkdirpdependency managernamesafeglaciervisualreducerelectrontappostcss-pluginwalkingowncloneratelimitomitspinnersl10nelmidlereducebufferrmdirhasshamassertionenvweaksetponyfilldeep-copyArray.prototype.flatMapstylesdebuggerless mixinssetterpipecensorcommanderajvmetadatasort-0syntaxlesshasOwnPropertyhandlerspreprocessorpropertiessymbolhardlinksbrowserlistmapreducefindLastfull-widthestreeStyleSheetlastpackages[[Prototype]]prototoSortedkeysxhrdirectoryfast-copyopenString.prototype.matchAllcontainshttpsastenderschemamatchAllserializerObservablesrfc4122ES5stringifierInt32ArrayconnectinputwaitgetOwnPropertyDescriptorshrinkwrapnopeperformanti18nlinuxrequestcode pointssqspropertycligetintrinsicmobileisConcatSpreadableECMAScript 7recursivegradients css3avalimitedWebSocketsvalidsomecollectionSymbol.toStringTagargumenteslintpluginvalidationlogger.envtypesafeESnextinternalhookformsearchdeletetypeerrortypeofpolyfillrobustawesomesauceextensioneast-asian-widthcloudfrontroutingflatbyteLengthflattenparenttostringtagreact-hook-formprotocol-buffersaccessibilitycorewhatwgECMAScript 2021rgbes-shimsduplexexpressMicrosoftECMAScript 2017ec2trimRightunicodecircularformdebugawslazypositiveagentbcryptcsstouchschemebatcheslintjavascriptcomputed-typesbootstrap csselasticacheInt8ArrayReflect.getPrototypeOfObject.entriescallbackasyncslicesequenceeslint-pluginkarmaequalstreamajaxsymlinksJSONqsSymbollook-upES2016ecmascriptfunctionECMAScript 2018a11ypackagelesscssECMAScript 2023es2017Uint8ClampedArrayes6definePropertyargsdirdescriptorless.jsinternal slotes7mimeECMAScript 2022stylesheetflatMapprettyjsxcreatekeyvariablesimmerfast-deep-clonemomentfast-clonemkdirautoprefixerObject.valuesObject.fromEntriesclassesreadableECMAScript 2015dayjss3stringifyjoitraversejapaneseObject.assignconsolecolourtoolsdescriptioncharacterlanguagereadablestreamwindowsarraybufferexitYAMLwarningoptimisttypedstyleguideassignjsdiffwritablevariables in cssobjectspeedlintxtermextraes-shim APIgetoptautoscalingprefixratequotescheme-validationauthcss lessapiES2018enumerablecloudformationTypedArrayvpcPromisestoragegatewaystyleglobstatelessdeepcopyBigInt64Arrayregexpropspinnerpush
1.0.0

8 months ago