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

refactor: ts and composition api for single instance components

This commit is contained in:
2022-05-14 11:15:42 +02:00
parent 45b2eb2934
commit 8a55b36527
12 changed files with 364 additions and 343 deletions

View File

@ -1,4 +1,8 @@
const arrayToFile = args => {
export const arrayToFile = (args: {
type: 'csv' | 'json';
content: object[];
filename: string;
}) => {
let mime;
let content;
@ -33,5 +37,3 @@ const arrayToFile = args => {
downloadLink.click();
downloadLink.remove();
};
export default arrayToFile;

View File

@ -1,16 +1,17 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { toRaw } from 'vue';
/**
* @param {*} val
* @param {Boolean} json converts the value in JSON object (default true)
*/
export function unproxify (val, json = true) {
export function unproxify (val: any, json = true): any {
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 = {};
const result: any = {};
for (const key in val)
result[key] = toRaw(val[key]);