wip: fix isList

This commit is contained in:
Philipp Kühn 2021-04-15 22:08:52 +02:00
parent 05434afc47
commit 6c2eea094c

View File

@ -1,6 +1,8 @@
import { Extensions } from '../types'
import { NodeConfig } from '..'
import splitExtensions from './splitExtensions'
import callOrReturn from '../utilities/callOrReturn'
import getExtensionField from '../helpers/getExtensionField'
export default function isList(name: string, extensions: Extensions): boolean {
const { nodeExtensions } = splitExtensions(extensions)
@ -10,11 +12,12 @@ export default function isList(name: string, extensions: Extensions): boolean {
return false
}
const groups = callOrReturn(extension.config.group, { options: extension.options })
const context = { options: extension.options }
const group = callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context))
if (typeof groups !== 'string') {
if (typeof group !== 'string') {
return false
}
return groups.split(' ').includes('list')
return group.split(' ').includes('list')
}