swc_core::ecma::utils

Function replace_ident

pub fn replace_ident<T>(node: &mut T, from: (Atom, SyntaxContext), to: &Ident)
where T: for<'any> VisitMutWith<IdentReplacer<'any>>,
Available on crate features __ecma and __utils only.
Expand description

Replace all from in expr with to.

§Usage

replace_ident(&mut dec.expr, cls_name.to_id(), alias);