From 8194c40c0e9fe355c8cddefd38951e61b206a37f Mon Sep 17 00:00:00 2001 From: DrChainsaw Date: Sun, 14 Aug 2022 16:30:53 +0200 Subject: [PATCH] Fix filter docstring --- src/datastructure.jl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/datastructure.jl b/src/datastructure.jl index f94260e..4561035 100644 --- a/src/datastructure.jl +++ b/src/datastructure.jl @@ -347,15 +347,14 @@ function Base.map(f, tree::FileTree; walk=postwalk, dirs=true) end """ - map(f, tree::FileTree; walk=FileTrees.postwalk, dirs=true) - -apply `f` to every node in the tree. To only visit File nodes, pass `dirs=false`. + filter(f, tree::FileTree; walk=FileTrees.postwalk, dirs=true) -walk can be either `FileTrees.postwalk` or `FileTrees.postwalk`. +Return a copy of `tree`, removing nodes for which `f` is `false`. - filter(f, tree::FileTree; walk=FileTrees.postwalk, dirs=true) +The function `f` is passed all nodes (`File`s and `FileTree`s) if `dirs=true` +and leaf nodes (`File`s) if `dirs=false`. -remove every node `x` from `tree` where `f(x)` is `true`. `f(x)` must return a boolean value. +`walk` can be either `FileTrees.postwalk` or `FileTrees.postwalk`. """ function Base.filter(f, tree::FileTree; walk=prewalk, dirs=true) walk(tree, collect_children=cs->filter(!isnothing, cs)) do n