@babel/plugin-transform-exponentiation-operator

NOTE: This plugin is included in @babel/preset-env, in ES2016

Example

In

  1. let x = 10 ** 2;
  2. x **= 3;

Out

  1. let x = Math.pow(10, 2);
  2. x = Math.pow(x, 3);

Installation

  1. npm install --save-dev @babel/plugin-transform-exponentiation-operator

Usage

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

Via CLI

  1. babel --plugins @babel/plugin-transform-exponentiation-operator script.js

Via Node API

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

References