Skip to content

Commit 6bd1cef

Browse files
Updates README.md
1 parent e28ab4c commit 6bd1cef

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ const tree = arrayToTree([
3939
{ id: '1', parentId: '418', custom: 'ZZZz' },
4040
{ id: '418', parentId: null, custom: 'ü'},
4141
])
42+
```
43+
44+
Which results in the following Array:
4245

43-
// output
44-
tree === [
46+
```js
47+
[
4548
{ data: { id: '4', parentId: null, custom: 'abc' }, children: [
4649
{ data: { id: '31', parentId: '4', custom: '12' }, children: [] },
4750
] },
@@ -69,9 +72,12 @@ const tree = arrayToTree([
6972
{ num: '1', ref: '418', custom: 'ZZZz' },
7073
{ num: '418', ref: null, custom: 'ü'},
7174
], { id: 'num', parentId: 'ref' })
75+
```
76+
77+
Which produces:
7278

73-
// output
74-
tree === [
79+
```js
80+
[
7581
{ data: { num: '4', ref: null, custom: 'abc' }, children: [
7682
{ data: { num: '31', ref: '4', custom: '12' }, children: [] },
7783
] },

0 commit comments

Comments
 (0)