tiptap/packages/core/src/helpers/splitExtensions.ts
Dominik 8c6751f0c6
add precommit hook for linting and automatic eslint fixes + update eslint packages (#2862)
* chore: add precommit hook for eslint fixes, fix linting issues
* chore: add eslint import sort plugin
2022-06-08 14:10:25 +02:00

17 lines
567 B
TypeScript

import { Extension } from '../Extension'
import { Mark } from '../Mark'
import { Node } from '../Node'
import { Extensions } from '../types'
export function splitExtensions(extensions: Extensions) {
const baseExtensions = extensions.filter(extension => extension.type === 'extension') as Extension[]
const nodeExtensions = extensions.filter(extension => extension.type === 'node') as Node[]
const markExtensions = extensions.filter(extension => extension.type === 'mark') as Mark[]
return {
baseExtensions,
nodeExtensions,
markExtensions,
}
}