| 1052 | * and the first element of `nextTokens` will be joined into a single token. |
| 1053 | */ |
| 1054 | const concatTokens = ( |
| 1055 | prevTokens: ReadonlyArray<string>, |
| 1056 | nextTokens: ReadonlyArray<string>, |
| 1057 | isSeparated: boolean |
| 1058 | ): ReadonlyArray<string> => |
| 1059 | isSeparated || prevTokens.length === 0 || nextTokens.length === 0 |
| 1060 | // Keep the previous and next tokens separate from one another |
| 1061 | ? [...prevTokens, ...nextTokens] |
| 1062 | // Join the last token from the previous set and the first token from the next set |
| 1063 | : [...prevTokens.slice(0, -1), `${prevTokens.at(-1)}${nextTokens.at(0)}`, ...nextTokens.slice(1)] |