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('string.prototype.matchall');const str = 'aabc';const nonRegexStr = 'ab';const globalRegex = /[ac]/g;const nonGlobalRegex = /[bc]/i;// non-regex arguments are coerced into a global regexassert.deepEqual( [...matchAll(str, nonRegexStr)], [...matchAll(str, new RegExp(nonRegexStr, 'g'))]);assert.deepEqual
Tests
Simply clone the repo, npm install, and run npm test