MCPcopy
hub / github.com/udecode/plate / mergePlugins

Function mergePlugins

packages/core/src/internal/utils/mergePlugins.ts:5–21  ·  view source on GitHub ↗
(basePlugin: T, ...sourcePlugins: any[])

Source from the content-addressed store, hash-verified

3import type { SlatePlugin } from '../../lib';
4
5export function mergePlugins<T>(basePlugin: T, ...sourcePlugins: any[]): T {
6 return mergeWith(
7 {},
8 basePlugin,
9 ...sourcePlugins,
10 (objValue: unknown, srcValue: unknown, key: keyof SlatePlugin) => {
11 // Overwrite array (including plugins) without cloning
12 if (Array.isArray(srcValue)) {
13 return srcValue;
14 }
15 // Shallow merge options
16 if (key === 'options') {
17 return { ...(objValue as any), ...(srcValue as any) };
18 }
19 }
20 );
21}

Callers 5

createSlatePluginFunction · 0.90
resolvePluginInputRulesFunction · 0.90
processPluginFunction · 0.90
applyOverridesFunction · 0.90
resolvePluginFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…