Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NARUTOne committed Apr 18, 2022
2 parents 79799bc + 321f6fe commit 5a6c043
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

> pm log 🚀⏲
## 0.8.2

`2022-04-16`

- 🐛修复`filterTreeFn`问题

## 0.8.1

`2021-12-23`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flo-utils",
"version": "0.8.1",
"version": "0.8.2",
"description": "some utils ",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/filterTreeFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function filterTreeFn(data, fn, childrenKey = 'children') {
let newData = data.filter(fn);
newData = newData.map((item) => {
const x = { ...item };
x[childrenKey] && (x[childrenKey] = filterTreeFn(x[childrenKey], fn));
x[childrenKey] &&
(x[childrenKey] = filterTreeFn(x[childrenKey], fn, childrenKey));
return x;
});

Expand Down

0 comments on commit 5a6c043

Please sign in to comment.