@websolutespa/payload-plugin-bowl
Version:
Bowl PayloadCms plugin of the BOM Repository
20 lines (19 loc) • 585 B
JavaScript
import { isDataField, isPresentationField } from '@websolutespa/payload-utils';
export function mergeFields(source = [], target = [], reverse = false) {
const targetDataFields = target.filter((t)=>isDataField(t));
const a = [
...source.filter((s)=>isPresentationField(s) || targetDataFields.findIndex((t)=>'name' in s && t.name === s.name) === -1)
];
const b = [
...target
];
const collections = reverse ? [
...b,
...a
] : [
...a,
...b
];
return collections;
}
//# sourceMappingURL=mergeFields.js.map