1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-25 13:23:42 +00:00
bramw_baserow/web-frontend/modules/database/utils/field.js
2022-07-20 18:07:00 +00:00

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]
}