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%
Rewrite JavaScript source so that sticky regex literals become equivalent RegExp constructor calls, while non-sticky regex usage remains unchanged.
/abc/y into new RegExp("abc","y") while preserving the original pattern text. @test/foo/gy becomes new RegExp("foo","gy")). @testRegExp constructor calls untouched, even when provided the y flag. @test@generates
/**
* Transforms sticky regex literals in JavaScript source code into RegExp constructor expressions.
* Non-sticky literals and existing RegExp constructor calls must remain unchanged.
*
* @param {string} source - JavaScript source to transform.
* @returns {string} transformed source code with sticky regex literals rewritten.
*/
export function transformStickyRegexes(source);Enables rewriting sticky regex literals into equivalent RegExp constructor calls during transformation.
@satisfied-by
Provides the transformation engine used to apply the plugin to source code.
@satisfied-by