@websolutespa/payload-plugin-bowl
Version:
Bowl PayloadCms plugin of the BOM Repository
17 lines (16 loc) • 638 B
JavaScript
import { options } from '../../options';
export function mergeGlobals(source = [], target = []) {
const collections = [
...target
];
const sourceGlobals = source.map((x)=>typeof x === 'function' ? x(options) : x);
const targetGlobals = target.map((x)=>typeof x === 'function' ? x(options) : x);
sourceGlobals.forEach((sourceGlobal, index)=>{
if (targetGlobals.findIndex((targetGlobal)=>targetGlobal.slug === sourceGlobal.slug) === -1) {
const global = source[index];
collections.push(global);
}
});
return collections;
}
//# sourceMappingURL=mergeGlobals.js.map