Polyman Documentation - v3.1.0
    Preparing search index...

    Function looseReplace

    • Replaces oldText when it matches whole lines of text once, comparing each line without the spaces at its start and end. newText gets the indent of the file: the difference between the file's first matched line and the first line of oldText is added to (or removed from) each line. Returns the new text, or how many places matched (0 or more than 1).

      Parameters

      • text: string
      • oldText: string
      • newText: string

      Returns string | { matches: number }