input not an arr, it is an arr or string or other

This commit is contained in:
RealBeepMcJeep 2023-08-30 13:03:01 -07:00
parent 9dfe42a7c3
commit 326c7d8841
1 changed files with 4 additions and 4 deletions

View File

@ -963,11 +963,11 @@ function charaFormatData(data) {
const char = tryParse(data.json_data) || {};
// Checks if data.alternate_greetings is an array, a string, or neither, and acts accordingly. (expected to be an array of strings)
const getAlternateGreetings = data => data.map(d => {
if (Array.isArray(d.alternate_greetings)) return d.alternate_greetings
if (typeof d.alternate_greetings === 'string') return [d.alternate_greetings]
const getAlternateGreetings = data => {
if (Array.isArray(data.alternate_greetings)) return data.alternate_greetings
if (typeof data.alternate_greetings === 'string') return [data.alternate_greetings]
return []
})
}
// Spec V1 fields
_.set(char, 'name', data.ch_name);