Skip to main content

fold_destructure_defaults

Function fold_destructure_defaults 

Source
pub fn fold_destructure_defaults(
    source: &str,
    language: &str,
) -> Result<String, RulesError>
Expand description

Fold a source string’s consecutive same-source let x = src?.x ?? d runs of length ≥ 2 into merged destructures. Returns the rewritten source (identical when nothing folds). language must name a tree-sitter grammar (e.g. "harn", "typescript").