tessl install tessl/npm-babel-plugin-transform-es2015-sticky-regex@6.24.0Babel plugin that transforms ES2015 sticky regex literals to ES5-compatible RegExp constructor calls
Agent Success
Agent success rate when using this tile
100%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.03x
Baseline
Agent success rate without this tile
97%
Build a helper that emits source compatible with runtimes lacking sticky regex support by running a transform that rewrites sticky regex literals into RegExp constructor calls with string-literal pattern and flag arguments.
const r = /foo/y; export default r.test("foofoo"); is transformed to code that uses new RegExp("foo", "y") in place of the literal while keeping surrounding code intact. @testconst r = /f.o/my; r.exec("f\no"); yields a constructor call whose flag string still includes both multiline and sticky semantics. @testconst plain = /bar/g; remains the same literal after transformation. @test@generates
export function transformStickyRegex(sourceCode: string): string;The function accepts JavaScript source code and returns the transformed source text.
Provides the transform pipeline used to run the plugin. @satisfied-by
Rewrites sticky regex literals into RegExp constructor calls using string-literal pattern and flags. @satisfied-by