react-code-dataset / react-page /packages /plugins /content /slate /src /pluginFactories /createDataPlugin.tsx
Download react-page/packages/plugins/content/slate/src/pluginFactories/createDataPlugin.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 716 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-page/packages/plugins/content/slate/src/pluginFactories/createDataPlugin.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-page/packages/plugins/content/slate/src/pluginFactories/createDataPlugin.tsx
-
curl -L -o createDataPlugin.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-page/packages/plugins/content/slate/src/pluginFactories/createDataPlugin.tsx
716 Bytes
| /* eslint-disable @typescript-eslint/ban-types */ | |
| import type { SlatePlugin } from '../types/SlatePlugin'; | |
| import type { SlateDataPluginDefinition } from '../types/slatePluginDefinitions'; | |
| function createDataPlugin<T extends Record<string, unknown>>( | |
| def: SlateDataPluginDefinition<T> | |
| ) { | |
| const customizablePlugin = function <CT>( | |
| customize: ( | |
| t: SlateDataPluginDefinition<T> | |
| ) => SlateDataPluginDefinition<T & CT> = (d) => | |
| d as unknown as SlateDataPluginDefinition<T & CT> | |
| ) { | |
| return createDataPlugin(customize(def)); | |
| }; | |
| customizablePlugin.toPlugin = (): SlatePlugin => ({ | |
| pluginType: 'data', | |
| ...def, | |
| }); | |
| return customizablePlugin; | |
| } | |
| export default createDataPlugin; | |