UNPKG
liquor-tree-withoutdragndrop
Version:
latest (0.2.72)
0.2.72
0.2.71
0.2.70
A Vue.js tree component.
github.com/SelectCode/liquor-tree
SelectCode/liquor-tree
liquor-tree-withoutdragndrop
/
src
/
utils
/
recurse.js
18 lines
(12 loc)
•
296 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export
function
recurseDown
(
obj, fn
) {
let
res
if
(
Array
.
isArray
(obj)) {
return
obj.
map
(
node
=>
recurseDown
(node, fn)) } res =
fn
(obj)
// Recurse children
if
(res !==
false
&& obj.
children
&& obj.
children
.
length
) { res =
recurseDown
(obj.
children
, fn) }
return
res }