mirror of
https://github.com/vale981/Vulcan
synced 2025-03-12 13:36:37 -04:00
19 lines
633 B
JavaScript
19 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;
|