@bitbeater/ecma-utils - v2.9.0
    Preparing search index...

    Function spacedWords

    • Separates text into an array of [whitespace, word] tuples, preserving the whitespace.

      Parameters

      • text: string

      Returns SplitTuple[]

      [[whitespace, word], ...]

      spacedWords('\t Hello \n world ')`
      // Returns:
      // [
      // ['\t ', 'Hello'],
      // [' \n ', 'world'],
      // [' ', '']
      // ]