mirror of
https://github.com/baserow/baserow.git
synced 2026-12-06 09:18:47 +00:00
11 lines
292 B
JavaScript
11 lines
292 B
JavaScript
/**
|
|
* Find the primary field in a list of fields.
|
|
* If no primary field is found, return the first field.
|
|
* @param fields
|
|
* @returns {*}
|
|
*/
|
|
export function getPrimaryOrFirstField(fields) {
|
|
const primaryField = fields.find((field) => field.primary)
|
|
return primaryField || fields[0]
|
|
}
|