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 Babel plugin that enforces a Babel 7+ requirement and rewrites sticky regex literals into equivalent constructor calls while leaving other regex literals untouched.
@generates
const r = /foo/y; becomes const r = new RegExp("foo", "y"); @testconst r = /foo/gy; becomes const r = new RegExp("foo", "gy"); @testconst r = /foo/g; stays const r = /foo/g; @testexport function transformSource(code: string): string;
// returns the transformed source code string after applying the plugin
export function transformFile(filePath: string): string;
// reads a file, applies the same transformation, and returns the transformed codeRewrites regex literals using the sticky flag into equivalent RegExp constructor calls while preserving pattern text and all flags.
Use this dependency to perform the transformation rather than reimplementing the same logic manually.
@satisfied-by