package
Spec-compliant polyfill for String.prototype.matchAll
npm install string.prototype.matchallGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
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 regex
assert.deepEqual(
[...matchAll(str, nonRegexStr)],
[...matchAll(str, new RegExp(nonRegexStr, 'g'))]
);
assert.deepEqual
Simply clone the repo, npm install, and run npm test
Estimated unpacked size across 62 packages.
4.0 MB+
Includes dependencies.
13 direct dependencies.
^1.2.0
1.2.0
^1.0.9
1.0.9
^1.3.0
1.3.0
^1.0.4
1.0.4
^1.24.2
1.24.2
^1.1.0
1.1.0
^1.1.2
1.1.2
^1.2.1
1.2.1
^2.0.2
2.0.2
^1.5.4
1.5.4