Accept scalar Scattermind build order sections
This commit is contained in:
@@ -1159,8 +1159,22 @@ function normalizeOptionIds(options = []) {
|
||||
});
|
||||
}
|
||||
|
||||
function candidateItems(value) {
|
||||
if (Array.isArray(value)) return value;
|
||||
if (typeof value === 'string' || typeof value === 'number') return cleanFlexibleTextList(value, 8, 260);
|
||||
const item = objectFrom(value);
|
||||
if (!Object.keys(item).length) return [];
|
||||
const hasCandidateShape = Boolean(
|
||||
item.id || item.title || item.name || item.action || item.move || item.step || item.task || item.instruction ||
|
||||
item.nextMove || item.next_move || item.nextStep || item.next_step || item.text || item.content || item.summary
|
||||
);
|
||||
return hasCandidateShape ? [item] : [];
|
||||
}
|
||||
|
||||
function compactCandidateGroup(group = []) {
|
||||
return group.filter(entry => Array.isArray(entry?.items) && entry.items.length > 0);
|
||||
return group
|
||||
.map(entry => ({ ...entry, items: candidateItems(entry?.items) }))
|
||||
.filter(entry => entry.items.length > 0);
|
||||
}
|
||||
|
||||
function buildOrderSectionGroup(buildOrder = {}, baseSection = 'buildOrder') {
|
||||
|
||||
Reference in New Issue
Block a user