Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
>(
extensions: AnyExtension[],
): ExtensionTags => {
const general: GeneralExtensionTags = {
[Tags.FormattingMark]: [],
[Tags.FormattingNode]: [],
[Tags.LastNodeCompatible]: [],
[Tags.NodeCursor]: [],
};
const mark: MarkExtensionTags = {
[MarkGroup.Alignment]: [],
[MarkGroup.Behavior]: [],
[MarkGroup.Color]: [],
[MarkGroup.FontStyle]: [],
[MarkGroup.Indentation]: [],
[MarkGroup.Link]: [],
[MarkGroup.Code]: [],
};
const node: NodeExtensionTags = { [NodeGroup.Block]: [], [NodeGroup.Inline]: [] };
for (const extension of extensions) {
if (isNodeExtension(extension)) {
const group = extension.schema.group as NodeGroup;
node[group] = isUndefined(node[group])
? [extension.name as GNodes]
: [...node[group], extension.name as GNodes];
} else if (isMarkExtension(extension)) {
const group = extension.schema.group as MarkGroup;
mark[group] = isUndefined(mark[group])
? [extension.name as GMarks]