MCPcopy Create free account
hub / github.com/SKaplanOfficial/Raycast-PromptLab / getObjectJSON

Function getObjectJSON

src/lib/common/object-utils.ts:12–24  ·  view source on GitHub ↗
(object: object)

Source from the content-addressed store, hash-verified

10 * @returns The JSON string representation of the object.
11 */
12export function getObjectJSON(object: object): string {
13 let objectKey = "item";
14 if (isCommand(object) || isStoreCommand(object)) {
15 objectKey = object.name;
16 } else if (isChat(object)) {
17 objectKey = `--chat-${object.name}`;
18 } else if (isModel(object)) {
19 objectKey = `--model-${object.name}`;
20 }
21
22 const objectWrapper = { [objectKey]: object };
23 return JSON.stringify(objectWrapper).replaceAll(/\\([^"])/g, "\\\\$1");
24}
25
26/**
27 * Gets the {@link ItemType} of an object.

Callers 1

CopyJSONActionFunction · 0.90

Calls 4

isCommandFunction · 0.90
isStoreCommandFunction · 0.90
isChatFunction · 0.90
isModelFunction · 0.90

Tested by

no test coverage detected