Skip to content

Commit

Permalink
docs(transformer): add documentation for exponentiation-operator plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Aug 22, 2024
1 parent 2a5e15d commit a14a0e2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions crates/oxc_transformer/src/es2016/exponentiation_operator.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
//! ES2016: Exponentiation Operator
//!
//! This plugin transforms the exponentiation operator (`**`) to `Math.pow`.
//!
//! > This plugin is included in `preset-env`, in ES2016
//!
//! ## Example
//!
//! Input:
//! ```js
//! let x = 10 ** 2;
//!
//! x **= 3;
//! ```
//!
//! Output:
//! ```js
//! let x = Math.pow(10, 2);
//!
//! x = Math.pow(x, 3);
//! ```
//!
//! ## Implementation
//!
//! Implementation based on [@babel/plugin-transform-exponentiation-operator](https://babel.dev/docs/babel-plugin-transform-exponentiation-operator).
//!
//! ## References:
//!
//! * Babel plugin implementation: <https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-exponentiation-operator>
//! * Exponentiation operator TC39 proposal: <https://github.com/tc39/proposal-exponentiation-operator>
//! * Exponentiation operator specification: <https://tc39.es/ecma262/#sec-exp-operator>
use std::cell::Cell;

use oxc_allocator::{CloneIn, Vec};
Expand Down

0 comments on commit a14a0e2

Please sign in to comment.