mirror of
https://github.com/vale981/Vulcan
synced 2025-03-13 05:46:38 -04:00
20 lines
633 B
JavaScript
20 lines
633 B
JavaScript
![]() |
/**
|
||
|
* Data structure to mix global Components and local FormComponents
|
||
|
* without the need to merge
|
||
|
*/
|
||
|
import { Components } from 'meteor/vulcan:core';
|
||
|
|
||
|
// Example with Proxy (might be unstable/hard to reason about)
|
||
|
//const mergeWithComponents = (myComponents = {}) => {
|
||
|
// const handler = {
|
||
|
// get: function(target, name) {
|
||
|
// return name in target ? target[name] : Components[name];
|
||
|
// }
|
||
|
// };
|
||
|
// const proxy = new Proxy(myComponents, handler);
|
||
|
// return proxy;
|
||
|
//};
|
||
|
const mergeWithComponents = myComponents => (myComponents ? { ...Components, ...myComponents } : Components);
|
||
|
|
||
|
export default mergeWithComponents;
|