Licence
MIT
Version
1.0.0
Deps
28
Size
18 kB
Vulns
0
Weekly
0
@drftgyhuji7npm/eius-quae-labore 
ES2020 spec-compliant shim for String.prototype.matchAll. Invoke its "shim" method to shim String.prototype.matchAll if it is unavailable or noncompliant.
This package implements the es-shim API interface. It works in an ES3-supported environment, and complies with the spec.
Most common usage:
const assert = require('assert');
const matchAll = require('@drftgyhuji7npm/eius-quae-labore');
const str = 'aabc';
const nonRegexStr = 'ab';
const globalRegex = /[ac]/g;
const nonGlobalRegex = /[bc]/i;
// non-regex arguments are coerced into a global regex
assert.deepEqual(
[...matchAll(str, nonRegexStr)],
[...matchAll(str, new RegExp(nonRegexStr, 'g'))]
);
assert.deepEqual([...matchAll(str, globalRegex)], [
Object.assign(['a'], { index: 0, input: str, groups: undefined }),
Object.assign(['a'], { index: 1, input: str, groups: undefined }),
Object.assign(['c'], { index: 3, input: str, groups: undefined }),
]);
assert.throws(() => matchAll(str, nonGlobalRegex)); // non-global regexes throw
matchAll.shim(); // will be a no-op if not needed
// non-regex arguments are coerced into a global regex
assert.deepEqual(
[...str.matchAll(nonRegexStr)],
[...str.matchAll(new RegExp(nonRegexStr, 'g'))]
);
assert.deepEqual([...str.matchAll(globalRegex)], [
Object.assign(['a'], { index: 0, input: str, groups: undefined }),
Object.assign(['a'], { index: 1, input: str, groups: undefined }),
Object.assign(['c'], { index: 3, input: str, groups: undefined }),
]);
assert.throws(() => matchAll(str, nonGlobalRegex)); // non-global regexes throw
Tests
Simply clone the repo, npm install, and run npm test
Keywords
nested cssauthenticationbootstrap lessbddnamestypesafeES2016ES2023performantinvarianthasObject.entriesCSSexedatastructuretyped-0full-widthrangeerrorenumerablei18nES3Int32ArraycompilertostringtagbrowserhandlersMicrosoftapolloparsersymbolsdescriptorvestWebSocketsmime-dbnodejsreuseregexpwordbreakbcrypttrimEndpurejsdiffcloneES2021symboldotenvtc39ECMAScript 6telephonestartname.envio-tsfast-clonetypestypeofTypeBoxintrinsic[[Prototype]]assertiongradients css3breakkoreandescriptorsshebangwritevalidateinstallasciiString.prototype.matchAllsyntaxregexjson-schema-validationthreeappmimetypesparsemomentspringtimearktypefindupES7astpolyfilldeeputil.inspectvalidscheme-validationshimtapeframerthrottleslicenopepackage.jsonbluebirdpromiselookbundlerwarningcurlUint32Arraylinkairbnbprotoperformancestyled-componentssortequalityconsumevariablesarrayconcurrencyimmergradients cssemojiqueryprocessdeep-copybytegetintrinsicfastcopygroupBygdprlistenerscomparebrowserlistArray.prototype.findLastgetstringifydeleteclassnamelaunchpreserve-symlinksECMAScript 2023monorepopatchrm -rfl10nzodurlupSetinterruptsfilterletcolourlook-uppathrgbcopyPromisewordwrapjsonschemaArrayBuffer#slicetranspilea11ycode pointssettingstrimRightpyyamlmixinsfilefigletsyntaxerrorjsrm -frjsxsequenceArray.prototype.findLastIndexpnpm9formsqueueMicrotasktexteventseditorunicodeextensionexecutablecore-jsnodeECMAScript 2019@@toStringTagdomresolvewatchFilewatcherexpressionflatMapFloat64ArrayduplexFloat32ArrayRegExp#flagsstartervisual_.extendHyBixtermoptimistmulti-packagereadablestreamlesscssStreamsclientyamltoArrayexites-shim APIECMAScript 7mobileYAMLinferencegrouprequireindicatorconnectqsprivate datapropertiesimmutablecallbackObservableescape3dvalueflattenpersistentbuffersanitizationtapcorefindregular expressionsasyncpreprocessorbuffersassertpackagecall-bindwatchingBigInt64ArrayarraysbusyFunction.prototype.namexsseventDispatcherECMAScript 2015stylesJSONmiddlewaresidedebuggersameValueZerochineselinuxgetOwnPropertyDescriptorxdges2015negative zeroprunemkdirpSymbolcolorsigtermfullwidthtypeerroraccessibilityworkerES6es2017checkcommand-lineemitcalltoobjectdefinePropertyisConcatSpreadablefsESnextslotRFC-6455dataviewruntimemakebannerlimitES2019stringifiermodulemimeenderuuidfindLastchromiumbatchaccessorReactiveXrmdircachereal-timerapides-abstractpromisesschemaestreeURLSearchParamsomitURLjasmineredactsanitizecommandsuperagentreduxcoercibleminimalstructuredCloneESharmonyes6WeakSetutilitiessetinternalObject.isponyfillvarWeakMapwhichconfiges-shimskeysfindLastIndexweaksetreaddeep-clonepushlintRxmoveforEachimporttrimLeftentriestypeviewconfigurablefastclonedaterequestfpreadablesearchobjectbindmetadatairqtoSortedchromeUnderscoreexecmkdirlimitedReflect.getPrototypeOffast-deep-clonediffdeterministicES2020globwritableless mixinsenvironmentArray.prototype.includescall-boundserializeTypedArrayArray.prototype.flatMapwrapstablestatelessredux-toolkitstylingcallboundwidthclass-validatordom-testing-libraryoptionECMAScript 5shellcssfromsymlinksES2022traversemergefantasy-landstreams2columndefaultserializerformTypeScriptmatchencryptionsignalsless compilerhelpersReactiveExtensionses7takewaapisharedRxJStoStringTagajaxbabel-coretranspilervalidationvariables in cssprototypelinewrapinspectprogressfunctionsurlsfastanimationnativestatuspasswordformattinglockfilewgetsymlinkbyteOffsetflatjsoncharacterstreamsmatchAllES5stylesetPrototypeOfschemeMapsuperstructcallbindcodesloggingclimacosshrinkwraptesterreact-testing-libraryincludesplugindependency managerfast-copyavacollectionhardlinksoncejsonpathlessclassestaskuser-streamsprivatebabelformatreact animation$.extendkarmaserializationopeneventEmitterrfc4122css lessmochadroppropArrayObject.keyspackage managerexpressArray.prototype.filterCSSStyleDeclarationiteratetslibratelimitIteratorfastifylastsorteddayjsframeworkObject.valuesmodulesspinnerslibphonenumberdragefficientutilitychannelecmascriptdeepcopywatchelectroncomputed-typeslogjQueryoptimizertrimStartsharedarraybufferECMAScript 2016childcorsworkspace:*terminalargscss-in-jscollection.es6rmcolorstrimjson-schemaapiargumenthasOwnchaifile systemArray.prototype.flatconcatidleshaminternal slotiteratorgetterisArrayBufferkeypropertyArray.prototype.containslazythroatawesomesaucereducerjapaneseArray.prototype.flattenposeless csstoolsreact-hook-formoutputvaluesopenercreatemapdataViewfind-uppackagesbundlingpopmotionobjspawncryptoObservableses8termconsoleconcatMapless.jsdataflagpipeinputwindowsStreamwalkingfolderqueuefetcheslintconfigassignbootstrap cssnumber
