@babel/plugin-transform-sticky-regex
info
This plugin is included in @babel/preset-env
Examples
In
JavaScript
const a = /o+/y;
Out
JavaScript
var a = new RegExp("o+", "y");
Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-transform-sticky-regex
yarn add --dev @babel/plugin-transform-sticky-regex
pnpm add --save-dev @babel/plugin-transform-sticky-regex
Usage
With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-transform-sticky-regex"]
}
Via CLI
Shell
babel --plugins @babel/plugin-transform-sticky-regex script.js
Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-sticky-regex"],
});