Skip to content

Commit e3f7a4b

Browse files
committed
data.Model: getFieldType() => convenience shortcut #6666
1 parent c1d5872 commit e3f7a4b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/data/Model.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ class Model extends Base {
8686
return this.fieldsMap.get(name) || null
8787
}
8888

89+
/**
90+
* Finds a field type by a given field name
91+
* @param {String} name
92+
* @returns {String|null} The lowercase field type or null if no match was found
93+
*/
94+
getFieldType(name) {
95+
return this.getField(name)?.type?.toLowerCase() || null
96+
}
97+
8998
/**
9099
* @param {Object[]} fields
91100
* @param {Boolean} isRoot=true

0 commit comments

Comments
 (0)