ai-comic-factory / src /lib /joinWords.ts
jbilcke-hf's picture
jbilcke-hf HF staff
work on a new approach: generate small chunks of a story instead of big one
9bcdb59
raw
history blame
363 Bytes
// clean a list of words (which may be null, undefined or empty)
// into one clean string of separator-divided (by default comma-separated) words
// the words will be trimmed, and empty elements will be removed
export function joinWords(inputs: any[] = [], separator = ", "): string {
return inputs.map(x => `${x || ""}`.trim()).filter(x => x).join(separator)
}