Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

OPT: check element fisrt #2429

Merged
merged 2 commits into from
Sep 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/getDataFromTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ export function walkTree(
) => boolean | void,
newContext: Map<any, any> = new Map(),
) {
if (Array.isArray(element)) {
element.forEach(item => walkTree(item, context, visitor, newContext));
if (!element) {
return;
}

if (!element) {

if (Array.isArray(element)) {
element.forEach(item => walkTree(item, context, visitor, newContext));
return;
}

Expand Down