fix static ram calc

This commit is contained in:
Olivier Gagnon 2021-10-27 16:17:02 -04:00
parent 9f14f2b863
commit 49d807c9a9
3 changed files with 5 additions and 18 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -163,22 +163,9 @@ async function parseOnlyRamCalculate(
// If it is, then we need to get its RAM cost. // If it is, then we need to get its RAM cost.
try { try {
function applyFuncRam(func: any): number { function applyFuncRam(func: any): number {
if (typeof func === "function") { console.log(func);
try { if (typeof func === "number") {
let res; return func;
if (func.constructor.name === "AsyncFunction") {
res = 0; // Async functions will always be 0 RAM
} else {
res = func.apply(null, []);
}
if (typeof res === "number") {
return res;
}
return 0;
} catch (e) {
console.error(`Error applying function: ${e}`);
return 0;
}
} else { } else {
return 0; return 0;
} }