mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
* refactor: streamline codebase, unify duplicated modules, and consolidate tests * fix(test): batch discovered test files into Windows-safe command lines
23 lines
575 B
JavaScript
23 lines
575 B
JavaScript
"use strict";
|
|
|
|
const { PluginRpcError, RPC_ERRORS } = require("./rpcRouter.cjs");
|
|
|
|
function invalidArgument(message) {
|
|
return new PluginRpcError(RPC_ERRORS.invalidArgument, message);
|
|
}
|
|
|
|
function freezeJson(value) {
|
|
const clone = structuredClone(value);
|
|
const freeze = (item) => {
|
|
if (!item || typeof item !== "object" || Object.isFrozen(item)) return item;
|
|
for (const child of Array.isArray(item) ? item : Object.values(item)) freeze(child);
|
|
return Object.freeze(item);
|
|
};
|
|
return freeze(clone);
|
|
}
|
|
|
|
module.exports = {
|
|
invalidArgument,
|
|
freezeJson,
|
|
};
|