From f70c2bb15542d0b24f534ede93d8425c2e174244 Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Thu, 18 Jun 2020 20:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20someTree=20=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/helper.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/utils/helper.ts b/src/utils/helper.ts index 5783e5e92..17baaf104 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -929,7 +929,17 @@ export function someTree( tree: Array, iterator: (item: T, key: number, level: number, paths: Array) => boolean ): boolean { - return !everyTree(tree, iterator); + let result = false; + + everyTree(tree, (item: T, key: number, level: number, paths: Array) => { + if (iterator(item, key, level, paths)) { + result = true; + return false; + } + return true; + }); + + return result; } /**