跳到主要内容

@babel/plugin-transform-sticky-regex

信息

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 install --save-dev @babel/plugin-transform-sticky-regex

Usage

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"],
});