@babel/plugin-transform-sticky-regex

sticky-regex - 图1info

This plugin is included in @babel/preset-env

Examples

In

JavaScript

  1. const a = /o+/y;

Out

JavaScript

  1. var a = new RegExp("o+", "y");

Installation

  • npm
  • Yarn
  • pnpm
  1. npm install --save-dev @babel/plugin-transform-sticky-regex
  1. yarn add --dev @babel/plugin-transform-sticky-regex
  1. pnpm add --save-dev @babel/plugin-transform-sticky-regex

Usage

babel.config.json

  1. {
  2. "plugins": ["@babel/plugin-transform-sticky-regex"]
  3. }

Via CLI

Shell

  1. babel --plugins @babel/plugin-transform-sticky-regex script.js

Via Node API

JavaScript

  1. require("@babel/core").transformSync("code", {
  2. plugins: ["@babel/plugin-transform-sticky-regex"],
  3. });