committed by
Vladimír Gorej
parent
dbd8931161
commit
ab1842083d
20
src/core/plugins/json-schema-2020-12/fn.js
Normal file
20
src/core/plugins/json-schema-2020-12/fn.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
export const upperFirst = (value) => {
|
||||
if (typeof value === "string") {
|
||||
return `${value.charAt(0).toUpperCase()}${value.slice(1)}`
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
export const getTitle = (schema) => {
|
||||
if (schema.title) return upperFirst(schema.title)
|
||||
if (schema.$anchor) return upperFirst(schema.$anchor)
|
||||
if (schema.$id) return schema.$id
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
export const isBooleanJSONSchema = (schema) => typeof schema === "boolean"
|
||||
Reference in New Issue
Block a user