mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
16 lines
317 B
JavaScript
16 lines
317 B
JavaScript
|
export default function flattenGroupedOptions(options) {
|
||
|
const flatOptions = [];
|
||
|
|
||
|
function getOptions(option) {
|
||
|
if (option.options) {
|
||
|
return option.options.forEach(getOptions);
|
||
|
}
|
||
|
|
||
|
flatOptions.push(option);
|
||
|
}
|
||
|
|
||
|
options.forEach(getOptions);
|
||
|
|
||
|
return flatOptions;
|
||
|
}
|