Skip to content

Commit

Permalink
docs(transformer/nullish-coalescing): correct doc comment
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 13, 2024
1 parent 834c94d commit 0ccb2ed
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions crates/oxc_transformer/src/es2020/nullish_coalescing_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,25 @@ impl<'a, 'ctx> NullishCoalescingOperator<'a, 'ctx> {
}
}

/// Create a conditional expression
/// Create a conditional expression.
///
/// ```js
/// // Input
/// bar ?? "qux"
/// foo = bar ?? "qux"
///
/// // Output
/// qux = bar !== null && bar !== void 0 ? bar : "qux"
/// // ^^^ assignment ^^^ reference ^^^ default
/// foo = bar !== null && bar !== void 0 ? bar : "qux"
/// // ^^^ assignment ^^^ reference ^^^^^ default
/// ```
///
/// reference and assignment are the same in this case, but they can be different
/// ```js
/// // Input
/// foo = bar.x ?? "qux"
///
/// // Output
/// foo = (_bar$x = bar.x) !== null && _bar$x !== void 0 ? _bar$x : "qux"
/// // ^^^^^^^^^^^^^^^^ assignment ^^^^^^ reference ^^^^^ default
/// ```
fn create_conditional_expression(
reference: Expression<'a>,
assignment: Expression<'a>,
Expand Down

0 comments on commit 0ccb2ed

Please sign in to comment.