1.0.0 • Published 12 days ago

@osjwnpm/veniam-esse-impedit v1.0.0

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

@osjwnpm/veniam-esse-impedit 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('@osjwnpm/veniam-esse-impedit');
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

coreFunction.prototype.nameregexpInt8Arraycachepackageshttpspreserve-symlinksajaxisConcatSpreadablePromisecjkconsoleomitinferenceWeakMapnegative zeroES2017namelimitinputECMAScript 5taskdefinePropertyutilityECMAScript 2022folderstyleguideInt32Array6to5findLastcurlhookformthrottleprotobufES2016streamsviewcolorsstatustacitflatMapbundlerlengthwidthmkdirvalidrgblintwalkingglobArray.prototype.flatReactiveXavawatchergdprexitES2019es5unicodebyteOffsetstatelessBigInt64ArrayArrayjson-schema-validationargumentswatchkeyduplexstyled-componentsgetintrinsicmonorepoxhrfind-upeverylinewraprandomconnecteslint-pluginredactcurriedECMAScript 6taperm -frpolyfillconcatMapresolvemetadatacorsobjectdebuggerloggingponyfillposereadabletextlruObject.getPrototypeOfcallcheckjestartxssweaksetlook-upidwaapidescriptorlookxdg-openreact-hooksECMAScript 2017datastructureformatfast-copybyteLengthstringifydeterministicwrapclass-validatorsafeinvariantJSONslotbluebirdRegExp.prototype.flagsvalidatorlauncherrordeep-copyeast-asian-widthpopmotionincludesmatchAllpromisesbootstrap lessreadablestream__proto__compile lessbusystylingdompreprocessorweblimitedsetPrototypeOfpositivenativeargparseObservableprunecallbackfile systemwaitdefinetoolkitchinesewarningtc39immerUint16ArrayentriesJSON-SchemaairbnbtoArrayiteratorterminalesUint8ArrayrobustshebangjwthandlersequaljsdiffaccessibilityeditorbatchES2021serializerargvmimeiepackage managertypedarraystrimconfigvalueeslintsignalssymlinksvarimmutableclientlastnodejsquerybufferssyntaxreactconcatwatchFilemime-dbtapcolumnscss variableprocesslockfilepicomatchlogequalityperformantdirtypesafewhichpropertymulti-packageconfigurablecommandthreegroupgesturescommand-lineArray.prototype.includesHyBiYAMLredux-toolkitenvironmentbannertelephonefastflattenparseBigUint64ArraysymbolapollobcryptsameValueZeroupString.prototype.trimlazymobilestylesless mixinsdescriptiontermspecexpressionio-tsbootstrap csschanneloncefantasy-landes-abstractconstArray.prototype.containsdayjssearchchildstableES2018extendexpressAsyncIteratorawesomesaucefixed-widthvalidationrfc4122.envsymbolsparenterror-handlingopensfull-widthdeepcopyarraybufferhashfunctionquerystringsignaltrimStartspawnspeedbufferprivate dataassertrequireArray.prototype.flatMapuser-streamsgetnegativecss nestingdiffES8nested cssreact-hook-formeventDispatcherdom-testing-libraryobjreusearrayssigtermtypeenderopentrimEndfpmrufsES2015call-boundsortedwatchingmixinsES7Object.fromEntriesfunctionsqueueMicrotaskbabelpoint-freemakeUint32Arraydragkeystypedarrayjsxcopytestprotorangeerrorvaluesjoiless csswebsitees6movepackage.jsonsidexdgES2023mochaes2016momentletpromiseArray.prototype.flattenObjectefficientprefixvestidleschemacoerciblecss lessObject.entriesObject.assignmkdirspackageautoprefixercode pointsshrinkwrapmimetypesstartercreateuuidsuperstructmkdirpratelimitirqRxjasminetdduninstallSetencryptiongetPrototypeOfarktypemiddlewarebytees2018react posefseventssortESnextrmdirstartcore-jshookssomeECMAScript 2016yupassertsutilitiesassigntypescriptES6classnamestslibdependenciesReactiveExtensionstoobjectwordwrapjssharedarraybufferzerolanguageoptimizersigintstylesheetreadperformanceoptionregularstringfast-deep-copytoStringTagwriteiseventsassertionhelpersoperating-systemindicatorutilsansiinternalexeccomparesyntaxerrortestertypanionhastranspiledebugESArrayBuffer.prototype.slicecharactersCSSStyleDeclarationharmonytypeofexit-codeweakmapECMAScript 7deepexecutableschemeES3ECMAScript 2020coloursanitizationtypeerrorfindworkspace:*consumerateprotocol-bufferslibphonenumbercryptreact animationflagsclassesparserjson-schema-validatores2017estreeInt16ArraylistenersurlformsArray.prototype.findLast3dfileflaggradients css3fast-cloneeslintpluginparentsrm -rfsymlinkRegExp#flagsjapanesereal-timebindanimationObject.isdataviewURLbrowserlistbddstreams2tostringtagslicetestingcss-in-jshasOwnchromiumreact-testing-libraryObject.keysmacostoSortedRxJStypedes2015browserslistrecursivetranspilerfullopenerastexeframerIteratorrmkarmaeslintconfigURLSearchParamsttydirectoryfindupfindLastIndexes7[[Prototype]]phoneimportvariablesreducerscheme-validationthroatStreamcommandernopecollectionString.prototype.matchAll
1.0.0

12 days ago