mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-25 13:23:42 +00:00
10 lines
292 B
JavaScript
10 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]
|
|
}
|