toolish - v0.2.5
    Preparing search index...

    Function swapOrAddElement

    • Replaces the first array element matching the given value with the given replacement, or else adds it to the end of the array.

      Type Parameters

      • T

      Parameters

      • array: T[]
      • value: T
      • replacement: T

      Returns undefined | T

      the original element if replaced, undefined if added