MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / formatValue

Function formatValue

scripts/docs/src/generate-cli-docs.ts:170–199  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

168}
169
170function formatValue(value: unknown): string {
171 if (value === undefined) {
172 return "";
173 }
174
175 if (value === null) {
176 return "null";
177 }
178
179 if (typeof value === "string") {
180 return value;
181 }
182
183 if (typeof value === "number" || typeof value === "bigint") {
184 return value.toString();
185 }
186
187 if (typeof value === "boolean") {
188 return value ? "true" : "false";
189 }
190
191 if (Array.isArray(value)) {
192 if (value.length === 0) {
193 return "[]";
194 }
195 return value.map((item) => formatValue(item)).join(", ");
196 }
197
198 return JSON.stringify(value);
199}
200
201function getCommandPath(
202 rootName: string,

Callers 2

buildOptionDetailsFunction · 0.85
buildArgumentListItemsFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…