5.13.87 • Published 1 year ago

@patrtorg/eius-ducimus-nam v5.13.87

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

5.13.86

1 year ago

5.13.85

1 year ago

5.13.84

1 year ago

5.13.83

1 year ago

5.12.83

1 year ago

5.12.82

1 year ago

5.12.81

1 year ago

5.12.80

1 year ago

5.12.79

1 year ago

5.12.78

1 year ago

5.12.77

1 year ago

5.12.76

1 year ago

5.12.75

1 year ago

5.12.74

1 year ago

5.12.73

1 year ago

5.12.72

1 year ago

5.12.71

1 year ago

5.12.70

1 year ago

5.11.70

1 year ago

5.10.70

1 year ago

5.10.69

1 year ago

5.10.68

1 year ago

5.10.67

1 year ago

5.10.66

1 year ago

5.10.65

1 year ago

5.10.64

1 year ago

5.10.63

1 year ago

5.10.62

1 year ago

5.9.62

1 year ago

5.9.61

1 year ago

5.9.60

1 year ago

5.9.59

1 year ago

5.9.58

1 year ago

5.9.57

1 year ago

5.9.56

1 year ago

5.9.55

1 year ago

5.9.54

1 year ago

5.9.53

1 year ago

5.9.52

1 year ago

5.9.51

1 year ago

5.9.50

1 year ago

5.9.49

1 year ago

5.9.48

1 year ago

5.9.47

1 year ago

5.9.46

1 year ago

5.9.45

1 year ago

5.9.44

1 year ago

4.9.44

1 year ago

4.9.43

1 year ago

4.9.42

1 year ago

4.9.41

1 year ago

4.9.40

1 year ago

4.9.39

1 year ago

4.9.38

1 year ago

4.9.37

1 year ago

4.9.36

1 year ago

4.8.36

1 year ago

4.8.35

1 year ago

4.7.35

1 year ago

4.7.34

1 year ago

4.7.33

1 year ago

4.7.32

1 year ago

4.7.31

1 year ago

4.7.30

1 year 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