2020-10-22 03:01:39 +08:00
|
|
|
import { Extensions } from '../types'
|
|
|
|
import { Extension } from '../Extension'
|
2020-10-22 17:19:49 +08:00
|
|
|
import { NodeExtension } from '../NodeExtension'
|
|
|
|
import { MarkExtension } from '../MarkExtension'
|
2020-10-22 03:01:39 +08:00
|
|
|
|
|
|
|
export default function splitExtensions(extensions: Extensions) {
|
|
|
|
const baseExtensions = extensions.filter(extension => extension.type === 'extension') as Extension[]
|
|
|
|
const nodeExtensions = extensions.filter(extension => extension.type === 'node') as NodeExtension[]
|
2020-10-22 03:13:38 +08:00
|
|
|
const markExtensions = extensions.filter(extension => extension.type === 'mark') as MarkExtension[]
|
2020-10-22 03:01:39 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
baseExtensions,
|
|
|
|
nodeExtensions,
|
2020-10-22 03:13:38 +08:00
|
|
|
markExtensions,
|
2020-10-22 03:01:39 +08:00
|
|
|
}
|
|
|
|
}
|