std
    Preparing search index...

    Function startsWithOneOf

    • Returns the matched prefix for the string (if it exists). Great for matching string union types.

      Type Parameters

      • T extends string

      Parameters

      • str: string
      • strings: readonly T[]

      Returns undefined | T

      startsWithOneOf('ab', 'a', 'c'); // 'a'
      startsWithOneOf('cc', 'a', 'b'); // undefined