Initial commit: funplay cocos mcp

This commit is contained in:
winlifes
2026-04-15 17:45:24 +08:00
commit efd3330922
19 changed files with 5379 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
'use strict';
function safeJsonParse(text, fallback = null) {
try {
return JSON.parse(text);
} catch (error) {
return fallback;
}
}
function safeStringify(value) {
const seen = new WeakSet();
return JSON.stringify(
value,
(key, current) => {
if (typeof current === 'object' && current !== null) {
if (seen.has(current)) {
return '[Circular]';
}
seen.add(current);
}
return current;
},
2
);
}
module.exports = {
safeJsonParse,
safeStringify,
};