mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
docs(transformer): add documentation for exponentiation-operator plugin (#5084)
follow-up #4881
This commit is contained in:
parent
4b49cf8ce4
commit
178d1bd986
1 changed files with 32 additions and 0 deletions
|
|
@ -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};
|
||||
|
|
|
|||
Loading…
Reference in a new issue