Skip to main content

convert_concat_to_tpl_expr

Function convert_concat_to_tpl_expr 

Source
pub fn convert_concat_to_tpl_expr(expr: Expr) -> Expr
Expand description

Converts a string .concat() call expression to a template literal expression.

§Arguments

  • expr - The expression to check and potentially convert

§Returns

  • The original expression if it’s not a concat call
  • A template literal expression if the expression is a valid concat call

§Example

Input: "hello".concat(world, "!")
Output: `hello${world}!`