5.13.87 • Published 10 months ago

@patrtorg/eius-ducimus-nam v5.13.87

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

@patrtorg/eius-ducimus-nam Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

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('@patrtorg/eius-ducimus-nam');

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

qscallzxcachees6lengthbrowserslistString.prototype.matchAllfunctionsawesomesaucesuperstructjsxinspectdeepcloneObject.assignfromes20183des8byteOffsetbuffertoobjectnopeownbabel-coretostringtagslicesequencecolourserializationsortmodulespackagesquerykinesisiteratormodulestringifiervarexecfilecharacterwindowsassignasyncismulti-packageeslintpluginenumerablejQueryUint32ArrayfluxenvironmentsdefinePropertysomewgetdatastructureES3arraysjoiworkspace:*phonedeep-copychromiumcolumnsdatetypedarraysimportcollection.es6assertionthreejson-schema-validatortermArrayjestwhatwgboundargumentredux-toolkittransportramdautilfantasy-landregexglobalsCSScurriedreadECMAScript 6l10nhasOwnbrowserlistless.jscompilerconcatMapfnmatchnegativekeysoffsetdiffhashjsonhookformvalidimportexportvisualtypescriptselfcall-bindeslintcomputed-typesintrinsicsameValueZeropurespawnrfc4122predictableunicodeloadingfastlanguageiteratecolorstypedgetintrinsicairbnbequalRegExp.prototype.flagsarrayanimationminimalfindstringinvarianttouchFloat32Array.gitignorestarterrobustdeterministicECMAScript 5trimEndlocalsigtermObject.valuesasteriskssymlinkrangeerrordomjsslotpreprocessorjsonschemacssidleArray.prototype.findLastharmonyECMAScript 2015east-asian-widthrfc9562workermobilemruelbgetPrototypeOffast-deep-copyObservablecss-in-jscss variablereuseES2017ES2023popmotionStreamnodejsprivate databcryptqueueMicrotaskloadbalancingECMAScript 2017transpilezerodependency managerinfindLastMappostcsssortedESstylespatchfastifycopyreact posetoSorteddescriptorsstylereversedbeanstalknested cssinternal slotdescriptionajvwalkArray.prototype.flatMapCSSStyleDeclarationchildshimobjectregular expressionArray.prototype.flatarktypejson-schema-validationbindflagstyped arrayindicatorFunction.prototype.namesubprocessgroupBymkdirsbinaryremovecloudsearchagentObjectroute53form-validationnpmES2016dirprotoObject.fromEntriesnegative zeromomentES2021timegradients cssES2018babelES5ECMAScriptflattenasciistablecloudtrailes2015call-boundmetadataArrayBuffer#sliceless cssinstallerarraybufferposegetOwnPropertyDescriptorpnpm9json-schemaprivatejavascriptencryptiontypesutilityreversesnsshrinkwrapweaksetcss nestingObject.definePropertyhasOwnPropertyutil.inspectfunctionalpreserve-symlinksweakmapschemafileenderwafES2015livepostcss-pluginendpointreact-hooksie$.extendextraArrayBufferTypeBoxPromiseESnexts3autoscalingclassesastclifile systemmovecommandmkdirpbinECMAScript 3parseHyBisqsRxlinkhotECMAScript 2019spinnereventEmitterperformanceyupiamlibphonenumberisConcatSpreadablecommanderstoragegatewayreal-timeinputdeepsignalsbddreadablestreamacornelasticacheframerbootstrap csscallboundconfigdropserializerassertsbundlingpushxtermpyyamlprototypees-shim APIObservablessetscheme-validationsettingsprunefindLastIndexprefixfixed-widthmkdirpluginlinuxuninstallformatsharedarraybufferuploadreact-componentTypeScriptbuffersfptraversevalidatorECMAScript 2018Array.prototype.flattencorebundlerresolvecryptoes-abstractbanneroncewaapiUint8ClampedArrayjsdiffpinoString.prototype.trimgradients css3ArrayBuffer.prototype.slicelruhooksdataviewdynamodbcoerciblecloudwatchWebSocketfpstddtslibaccessorReactiveExtensionsttypromisesignalexit-codecloudformationautoprefixerspinnersreplaydataViewvalueES8propArray.prototype.containslockfilegitignorewindowdragchannelqueueartutilsirqconsoletc39takenodeperformantInt16ArraystylesheetvaluesInt8Arraydependenciesreducereventsstatusfast-deep-cloneECMAScript 2022expressinterruptsfulloptimist.envcolumnsymboltoStringTagapieslint-plugincommand-lineregular-expressionebselectrontacitreact-testing-librarytypeerrorbootstrap lessexecdatacallbindsetImmediateSymbol.toStringTagoptionpropertiesmatchAllgenericstypeof@@toStringTagswftrimStartpasswordtesterregularlessclonecomparetrimrulesletamazonES2020whichurleverycollectionschemebusylazytelephonesafees2017BigUint64ArrayjwtxhrAsyncIteratorefficientmacosescapeidentifiersrouteURLgetterstylinges5yamlsidetoReversedtoolspicomatchfetchES2019outputfigletpersistenttsomittestglobal this valuecss lessemrargsregexpbinariesdotenvsyntaxerrorECMAScript 2020lastvalidatetypanionhandlersmake dirstructuredClonestatestatelesshelpersshelltrimLeftstyleguideseswritableJSON-SchemastringifytypevariablesYAMLsetPrototypeOfSystem.global6to5es7has-ownaccessibilityenves2016operating-systemtestingArray.prototype.filterparsingstreamsfilterinstallspeedjsdomArray.prototype.findLastIndexless compilerIteratorvpcextendclassnamesObject.isES2022environmentECMAScript 7lintgloballoggingerrorwidthcryptimmernamesyntaxreadableSymbolconstmergequerystringcjkec2deleteforEacheffect-tsStreamsobjcore-jsdescriptorreduxECMAScript 2023equalityfastcopyajaxcensorrandomglobal objectincludesstreamentriesECMAScript 2021forkopensslTypedArrayexecuteReflect.getPrototypeOfmanager-0_.extendglaciermakevariables in cssWebSocketscontainsglobprogress256sigintassertpositiveclassnamedefineglobalThischinesestyled-componentsRegExp#flagsdom-testing-librarypathshamexpressionvarsflatMapelmnumbermatchserializepoint-freeFloat64Arrayguidfast-copyreactloggerdayjsECMAScript 2016BigInt64ArraycheckReactiveXkoreanJSONbyteLengthcolorrequesthelpertrimRightStyleSheetmapsharedrequirewritehttpjshintignorehttpsutilitiesauthenticationchrome0__proto__fullwidthchaifunction.lengthcloudfrontruntimenpmignoreuser-streamsgetbrowsercreateworkflowsymbolsmapreduceio-tscompile lesseslintconfigES6grouppropertyecmascripttoolkitmatchescertificatesformsuperagentflagdeepcopyquotees-shimsObject.entriesbytespringrgbsymlinksa11yclientesreact animationawsdeep-clonelogmixinsWeakMapformattingdirectoryUint16Arrayvalidationerror-handlingsimpledbgesturesflati18nArray.prototype.includeswarningpackage manageruuidUint8ArrayObject.getPrototypeOfeventDispatcherpackage.jsonpipehigher-ordercallbacktoArrayprettyconfigurableestreereducehasexitmonorepointernalviewrdstranspilerponyfillRxJSoptimizerfastcloneansiUnderscorecurllistenersless mixinsgraphqltypedarraynativeInt32ArrayemitauthObject.keysconcatpolyfillfunctionWeakSetcodesterminalapollospecSetwaitprotocol-buffersshebangargvprotobufredactfsrapidkeyrecursivegdprfast-clonereact-hook-formnamesPushproxytextcircularparsersetterjapanese
5.13.87

10 months ago

5.13.86

10 months ago

5.13.85

10 months ago

5.13.84

10 months ago

5.13.83

10 months ago

5.12.83

10 months ago

5.12.82

10 months ago

5.12.81

10 months ago

5.12.80

10 months ago

5.12.79

10 months ago

5.12.78

10 months ago

5.12.77

10 months ago

5.12.76

10 months ago

5.12.75

10 months ago

5.12.74

10 months ago

5.12.73

11 months ago

5.12.72

11 months ago

5.12.71

11 months ago

5.12.70

11 months ago

5.11.70

11 months ago

5.10.70

11 months ago

5.10.69

11 months ago

5.10.68

11 months ago

5.10.67

11 months ago

5.10.66

11 months ago

5.10.65

11 months ago

5.10.64

11 months ago

5.10.63

11 months ago

5.10.62

11 months ago

5.9.62

11 months ago

5.9.61

11 months ago

5.9.60

11 months ago

5.9.59

11 months ago

5.9.58

11 months ago

5.9.57

11 months ago

5.9.56

11 months ago

5.9.55

11 months ago

5.9.54

11 months ago

5.9.53

11 months ago

5.9.52

11 months ago

5.9.51

11 months ago

5.9.50

11 months ago

5.9.49

11 months ago

5.9.48

11 months ago

5.9.47

11 months ago

5.9.46

12 months ago

5.9.45

12 months ago

5.9.44

12 months ago

4.9.44

12 months ago

4.9.43

12 months ago

4.9.42

12 months ago

4.9.41

12 months ago

4.9.40

12 months ago

4.9.39

12 months ago

4.9.38

12 months ago

4.9.37

12 months ago

4.9.36

12 months ago

4.8.36

12 months ago

4.8.35

12 months ago

4.7.35

12 months ago

4.7.34

12 months ago

4.7.33

12 months ago

4.7.32

12 months ago

4.7.31

12 months ago

4.7.30

12 months ago

4.7.29

1 year ago

4.6.29

1 year ago

4.6.28

1 year ago

4.6.27

1 year ago

4.5.27

1 year ago

4.5.26

1 year ago

3.5.26

1 year ago

3.5.25

1 year ago

3.5.24

1 year ago

3.4.24

1 year ago

3.4.23

1 year ago

3.4.22

1 year ago

3.4.21

1 year ago

3.4.20

1 year ago

3.4.19

1 year ago

3.4.18

1 year ago

3.3.18

1 year ago

3.3.17

1 year ago

3.3.16

1 year ago

3.2.16

1 year ago

3.2.15

1 year ago

3.2.14

1 year ago

3.1.14

1 year ago

3.1.13

1 year ago

3.0.13

1 year ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

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