Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

refactor code

AykutSarac34cb0db0de5a
diff --git a/src/utils/json-editor-parser.ts b/src/utils/json-editor-parser.ts
index 5b8c3759..c04e8ef6 100644
--- a/src/utils/json-editor-parser.ts
+++ b/src/utils/json-editor-parser.ts
@@ -1,9 +1,11 @@
import toast from "react-hot-toast";
const filterChild = ([k, v]) => {
- const notNull = v !== null;
- const isArray = Array.isArray(v) ? !!v.length : typeof v === "object";
- return notNull && isArray;
+ const isNull = v === null;
+ const isArray = Array.isArray(v) && v.length;
+ const isObject = v instanceof Object;
+
+ return !isNull && (isArray || isObject);
};
const filterValues = ([k, v]) => {