2.1.23 • Published 1 year ago

@juigorg/iure-exercitationem-sit v2.1.23

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

@juigorg/iure-exercitationem-sit 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('@juigorg/iure-exercitationem-sit');
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

es7es8Array.prototype.findLastIndexairbnbreadablestylesheetcolourSymbolauthenticationeslintconfigsyntaxerrorbcryptirqtslibcliregularendpointboundcryptoparentsdeepcopyfunctionArray.prototype.findLastcontainsstyled-componentsECMAScript 2023tapqueuecolorfindLastES2022fullRxstatuspackagerouteownglacierbyteLengthschemeerrornameswatchingclassnameutilitiesstylebeanstalkautoprefixerrfc4122symbolweaksetconfiggradients cssqsconsoleintrinsicttyes5configurableObject.valuesargs0settingsstreamsUnderscoredeep-cloneWeakSetprocessterminalObservablesECMAScript 3ECMAScript 2021fpsECMAScript 2022getintrinsicformatdescriptiondefineratevaluecomputed-typesfast-cloneflatMapmonorepoequaldatastructurecolors_.extendtoStringTagTypeBoxReactiveXreadrobustefficientprotopostcss-pluginloadingeslintpluginoptimistECMAScript 6getOwnPropertyDescriptorvariablescommandstdlibtoArrayReflect.getPrototypeOfassertseslintmatcheshas-owncompile lesstoolsbannerlinewrappatchMicrosoftobjectgroupmake dirsesenderdynamodbCSSES2019AsyncIteratores-abstractmkdirArrayRegExp.prototype.flagses2016utilityarrayspropajaxfastcloneemitlibphonenumberStyleSheetsortedjsximmergraphqlfastifyfiltereventsescapebyteOffsetenvArrayBuffermrukarmafindupnegative zeroObject.definePropertyio-tswarningchaisymlinkoutputfindtostringtagmergeeast-asian-widthWeakMapfastcopyslotwordbreakrapidtoolkitconcatrequirermdirsignalsproxyinterruptsargparselook-upwordwrapunicodeparsingcore-jstestvalidvariables in csshttpslinkrgbmoment-0swfyupSetless mixinscloudformationpredictablearraylanguageaststablesetPrototypeOfsideUint8ArrayweakmapeventDispatcheroncecode pointsyamlgetoptforEachcallbindArray.prototype.includesworkerspeedinferencelessURLSearchParamsES5tapesomeprotobufnested cssguidfindLastIndexES7fast-copyES2021preserve-symlinksphonelazyPushInt8Arrayes-shim APIjavascriptpyyamlUint32Arraycommand-linecsscjktaskconcurrencystringifyflatstarterfast-deep-clonerandomES2020descriptorsclasseshotreplayvalidateES2016Streamsreal-timedomdatePromisewaitcss-in-jsawaitzeroglobIteratorl10nsyntaxwalkdeep-copycloudfrontbundleromitBigUint64Arraypushloggerfile systemfseventselbpropertiesmapreduceiterationObject.assignes2018idlebundlingwaftypedarrayshashgettertyperesolveieiamJSONcodesserializationreducerlimitrecursivehigher-orderiscreatepackage.jsonSymbol.toStringTagapolloECMAScript 2015typedpostcssinternaltelephoneimmutablehasOwnPropertysimpledbless compilerstyleguidea11yagentfsredux-toolkitkoreanhardlinkspluginschemalistenersnopeasciiuproute53call-bindUint8ClampedArrayruntimeajvdataviewnpmaccessoropenReactiveExtensionsamazonchromiumnumberObservableperformancemimetypesparsertouchexectrimLeftprototypemacosjsdiffhttpbddcall-boundhasregular expressionshelpersqueryqueueMicrotaskminimalArrayBuffer.prototype.slicebindtraversewritableexpressionvisualhookspasswordnativenamecensoroptionformattingidRFC-6455limitedfromcommandermoduleclientelmcallboundreact-testing-librarydefinePropertybusyisConcatSpreadableemojispinnersnodesymlinksdependencies256Array.prototype.containspathsetterpropertymulti-packagetexttc39es6shellshamtypeofstylesjsonpathjestcollection.es6polyfillObjectless.jswebCSSStyleDeclarationuuidless csslintdataYAMLfull-widthserializemobileelasticachewindowsrangeerrorhookformprivate datajoiawsdeepwritelinuxenumerableprefixencryptionremovetypespreprocessorURLECMAScript 2017equalityecmascriptslicebatchdeterministicString.prototype.trimflagparsemkdirsfigletcolumnspromisedifferror-handlingbrowserslistdom-testing-libraryawesomesaucetddreadablestreamtrimhandlersponyfillwidthloadbalancingwhatwgbootstrap lesstesterxtermES2018cloudwatchargvcurl.envassertionfunctionsjQueryvalidationrm -rfdropTypedArraycloudsearchHyBidirectorysetstylingcharacterprivatewhichlivekeysdebuggerRxJSECMAScript 2016react-hook-formgenericswgetdescriptorartECMAScript 2019reduceiteratorES2015toSortedrm -frredactmiddlewareregexp
2.1.23

1 year ago

2.1.21

1 year ago

2.1.22

1 year ago

2.0.19

1 year ago

2.0.18

1 year ago

2.0.20

1 year ago

2.0.21

1 year ago

2.0.17

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

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