{"id":27944914,"url":"https://github.com/es-shims/string.prototype.matchall","last_synced_at":"2025-05-07T12:55:12.269Z","repository":{"id":56212511,"uuid":"98674922","full_name":"es-shims/String.prototype.matchAll","owner":"es-shims","description":"Spec-compliant polyfill for String.prototype.matchAll, in ES2020","archived":false,"fork":false,"pushed_at":"2024-12-20T07:01:46.000Z","size":223,"stargazers_count":17,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T12:55:04.612Z","etag":null,"topics":["ecmascript","javascript","match","matchall","polyfill","regex","regexp","shim","string"],"latest_commit_sha":null,"homepage":"https://github.com/tc39/proposal-string-matchall","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/es-shims.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/es5-shim","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-07-28T18:03:38.000Z","updated_at":"2024-12-20T07:01:51.000Z","dependencies_parsed_at":"2024-06-18T14:06:11.273Z","dependency_job_id":"e93c0b79-088c-49ff-a7e9-625a96e3014e","html_url":"https://github.com/es-shims/String.prototype.matchAll","commit_stats":{"total_commits":156,"total_committers":1,"mean_commits":156.0,"dds":0.0,"last_synced_commit":"cbf79c8f5d1c3505a28f694d827d638a266c0012"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.matchAll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.matchAll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.matchAll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FString.prototype.matchAll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/es-shims","download_url":"https://codeload.github.com/es-shims/String.prototype.matchAll/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252882789,"owners_count":21819154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecmascript","javascript","match","matchall","polyfill","regex","regexp","shim","string"],"created_at":"2025-05-07T12:55:11.380Z","updated_at":"2025-05-07T12:55:12.253Z","avatar_url":"https://github.com/es-shims.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ljharb","https://tidelift.com/funding/github/npm/es5-shim"],"categories":[],"sub_categories":[],"readme":"# string.prototype.matchall \u003csup\u003e[![Version Badge][npm-version-svg]][package-url]\u003c/sup\u003e\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nES2020 spec-compliant shim for String.prototype.matchAll. Invoke its \"shim\" method to shim `String.prototype.matchAll` if it is unavailable or noncompliant.\n\nThis package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment, and complies with the [spec](https://tc39.es/ecma262/#sec-string.prototype.matchall).\n\nMost common usage:\n```js\nconst assert = require('assert');\nconst matchAll = require('string.prototype.matchall');\n\nconst str = 'aabc';\nconst nonRegexStr = 'ab';\nconst globalRegex = /[ac]/g;\nconst nonGlobalRegex = /[bc]/i;\n\n// non-regex arguments are coerced into a global regex\nassert.deepEqual(\n\t[...matchAll(str, nonRegexStr)],\n\t[...matchAll(str, new RegExp(nonRegexStr, 'g'))]\n);\n\nassert.deepEqual([...matchAll(str, globalRegex)], [\n\tObject.assign(['a'], { index: 0, input: str, groups: undefined }),\n\tObject.assign(['a'], { index: 1, input: str, groups: undefined }),\n\tObject.assign(['c'], { index: 3, input: str, groups: undefined }),\n]);\n\nassert.throws(() =\u003e matchAll(str, nonGlobalRegex)); // non-global regexes throw\n\nmatchAll.shim(); // will be a no-op if not needed\n\n// non-regex arguments are coerced into a global regex\nassert.deepEqual(\n\t[...str.matchAll(nonRegexStr)],\n\t[...str.matchAll(new RegExp(nonRegexStr, 'g'))]\n);\n\nassert.deepEqual([...str.matchAll(globalRegex)], [\n\tObject.assign(['a'], { index: 0, input: str, groups: undefined }),\n\tObject.assign(['a'], { index: 1, input: str, groups: undefined }),\n\tObject.assign(['c'], { index: 3, input: str, groups: undefined }),\n]);\n\nassert.throws(() =\u003e matchAll(str, nonGlobalRegex)); // non-global regexes throw\n\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.com/package/string.prototype.matchall\n[npm-version-svg]: https://versionbadg.es/es-shims/String.prototype.matchAll.svg\n[deps-svg]: https://david-dm.org/es-shims/String.prototype.matchAll.svg\n[deps-url]: https://david-dm.org/es-shims/String.prototype.matchAll\n[dev-deps-svg]: https://david-dm.org/es-shims/String.prototype.matchAll/dev-status.svg\n[dev-deps-url]: https://david-dm.org/es-shims/String.prototype.matchAll#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/string.prototype.matchall.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/string.prototype.matchall.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/string.prototype.matchall.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=string.prototype.matchall\n[codecov-image]: https://codecov.io/gh/es-shims/String.prototype.matchAll/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/es-shims/String.prototype.matchAll/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/String.prototype.matchAll\n[actions-url]: https://github.com/es-shims/String.prototype.matchAll/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Fstring.prototype.matchall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fes-shims%2Fstring.prototype.matchall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Fstring.prototype.matchall/lists"}