MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / stringifyMetaValue

Function stringifyMetaValue

src/shared/MetaEdit.ts:70–93  ·  view source on GitHub ↗
(value: string | string[] | Tag[] | boolean | undefined)

Source from the content-addressed store, hash-verified

68}
69
70export function stringifyMetaValue(value: string | string[] | Tag[] | boolean | undefined): string {
71 if (Array.isArray(value)) {
72 if (value.length > 0) {
73 const stringArray = (typeof value[0] === 'string')
74 ? (value as string[])
75 : (value as Tag[]).map(v => v.name);
76
77 return `[ ${stringArray.map(v => `"${v}"`).join(', ')} ]`;
78 } else {
79 return '[ empty array ]';
80 }
81 }
82
83 switch (typeof value) {
84 case 'string':
85 return `"${value}"`;
86
87 case 'boolean':
88 return value ? 'true' : 'false';
89
90 case 'undefined':
91 return 'undefined';
92 }
93}

Callers 2

DeveloperPageClass · 0.90
importAllMetaEditsFunction · 0.90

Calls 1

mapMethod · 0.65

Tested by

no test coverage detected