@websolutespa/payload-plugin-bowl
Version:
Bowl PayloadCms plugin of the BOM Repository
18 lines (17 loc) • 729 B
JavaScript
import { options } from '../../options';
// !!! todo remove unused mergeCollections
export function mergeCollections(source = [], target = []) {
const collections = [
...target
];
const sourceCollections = source.map((x)=>typeof x === 'function' ? x(options) : x);
const targetCollections = target.map((x)=>typeof x === 'function' ? x(options) : x);
sourceCollections.forEach((sourceCollection, index)=>{
if (targetCollections.findIndex((targetCollection)=>targetCollection.slug === sourceCollection.slug) === -1) {
const collection = source[index];
collections.push(collection);
}
});
return collections;
}
//# sourceMappingURL=mergeCollections.js.map