refactor code

This commit is contained in:
AykutSarac 2022-08-01 09:22:52 +03:00
parent b45064e955
commit 34cb0db0de

View File

@ -1,9 +1,11 @@
import toast from "react-hot-toast"; import toast from "react-hot-toast";
const filterChild = ([k, v]) => { const filterChild = ([k, v]) => {
const notNull = v !== null; const isNull = v === null;
const isArray = Array.isArray(v) ? !!v.length : typeof v === "object"; const isArray = Array.isArray(v) && v.length;
return notNull && isArray; const isObject = v instanceof Object;
return !isNull && (isArray || isObject);
}; };
const filterValues = ([k, v]) => { const filterValues = ([k, v]) => {