mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-12 19:02:53 +08:00
refactor code
This commit is contained in:
parent
b45064e955
commit
34cb0db0de
@ -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]) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user