(object: object)
| 10 | * @returns The JSON string representation of the object. |
| 11 | */ |
| 12 | export 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. |
no test coverage detected