function getTextListFromString(str: string): string[] { return str .trim() // Remove leading and trailing whitespace .split(/\s*\n\s*|\s+/) // Split by new lines or spaces .filter(word => word.length > 0); // Filter out any empty strings } export default getTextListFromString;