1 parent 0e352a3 commit 80d01d5Copy full SHA for 80d01d5
1 file changed
src/textHelper.ts
@@ -72,8 +72,17 @@ export function text(
72
* @param words list of words
73
* @returns written list
74
*/
75
-export function writeList(words: (Writable | string)[]): string {
76
- if (words.length === 0) return '';
+export function writeList(
+ words: (Writable | string)[],
77
+ emptyMessage?: Writable | string
78
+): string {
79
+ if (words.length === 0) {
80
+ if (emptyMessage) {
81
+ if (typeof emptyMessage === 'string') return emptyMessage;
82
+ return emptyMessage.write();
83
+ }
84
+ return '';
85
86
if (words.length === 1) {
87
if (typeof words[0] === 'string') return words[0];
88
return words[0].write();
0 commit comments