( controlElement: ControlElement, schemaElement?: JsonSchema )
| 29 | import { decode } from './path'; |
| 30 | |
| 31 | const deriveLabel = ( |
| 32 | controlElement: ControlElement, |
| 33 | schemaElement?: JsonSchema |
| 34 | ): string => { |
| 35 | if (schemaElement && typeof schemaElement.title === 'string') { |
| 36 | return schemaElement.title; |
| 37 | } |
| 38 | if (typeof controlElement.scope === 'string') { |
| 39 | const ref = controlElement.scope; |
| 40 | const label = decode(ref.substr(ref.lastIndexOf('/') + 1)); |
| 41 | return startCase(label); |
| 42 | } |
| 43 | |
| 44 | return ''; |
| 45 | }; |
| 46 | |
| 47 | export const createCleanLabel = (label: string): string => { |
| 48 | return startCase(label.replace('_', ' ')); |
no test coverage detected
searching dependent graphs…