platform-bible-utils
    Preparing search index...

    Function collapseMiddleWords

    • Shortens text by splitting by space, removing tokens from the middle and replacing them with [...]

      Parameters

      • text: string

        The input text

      • numberOfTokensToKeepBeforeAndAfter: number

        Count of space separated tokens to keep at the beginning and end of the text

      Returns string

      The full text if shorter than tokens to keep for beginning plus end, otherwise the first x tokens, followed by [...] and the last x tokens