MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / deriveLabel

Function deriveLabel

packages/core/src/util/label.ts:31–45  ·  view source on GitHub ↗
(
  controlElement: ControlElement,
  schemaElement?: JsonSchema
)

Source from the content-addressed store, hash-verified

29import { decode } from './path';
30
31const 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
47export const createCleanLabel = (label: string): string => {
48 return startCase(label.replace('_', ' '));

Callers 1

Calls 1

decodeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…