1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

refactor: improved Proxy handlement on ipc

This commit is contained in:
2022-04-24 12:17:29 +02:00
parent 3eb781021c
commit 4f8bc26349
11 changed files with 90 additions and 70 deletions

View File

@ -0,0 +1,21 @@
import { toRaw } from 'vue';
/**
* @param {*} val
* @param {Boolean} json converts the value in JSON object (default true)
*/
export function unproxify (val, json = true) {
if (json)// JSON conversion
return JSON.parse(JSON.stringify(val));
else if (Array.isArray(val))// If array
return toRaw(val);
else if (typeof val === 'object') { // If object
const result = {};
for (const key in val)
result[key] = toRaw(val[key]);
return result;
}
else
return toRaw(val);
}