mylingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
28 lines • 1.17 kB
JavaScript
import getDefaultValue from "../../interface/utils/getDefaultValue";
import nonEditorSchemaSet from "../../interface/utils/nonEditorSchemaSet";
export default (schema, defaults, target) => {
const params = {};
for (const [key, value] of Object.entries(schema)) {
if (nonEditorSchemaSet.has(key))
continue;
let currentVal = target[key];
if (value === Function || typeof currentVal === "function")
continue;
if (value === Object ||
(typeof currentVal === "object" && !Array.isArray(currentVal)))
if (!currentVal ||
typeof currentVal.x !== "number" ||
typeof currentVal.y !== "number")
continue;
currentVal ??= getDefaultValue(defaults, key, true);
if (currentVal === Infinity)
currentVal = 999999999;
else if (currentVal === -Infinity)
currentVal = -999999999;
else if (Array.isArray(currentVal))
currentVal = JSON.stringify(currentVal);
params[key] = currentVal;
}
return params;
};
//# sourceMappingURL=getParams.js.map