Fix for Node Path instance not being sent to onEachFile and onEachDirectory callbacks
The README says: "The callback function takes the directory item (has path, name, size, and extension) and an instance of node path and an instance of node FS.stats."
However, the callbacks are not sent the Node Path instance but instead are sent the path variable.
Changing from path to PATH fixes it to work as described in the README.
@photonstorm thanks for the PR! Going over this I was actually thinking - why do we even need the path module passed as an argument to the callback function?
I went through git history and it was added like that from a contribution, but really - do we need it? Seems to complicate things. I'm guessing if one needs the node path module they can simply require it in their code, no?
(If you agree, perhaps we could turn around this PR into actually removing that arg altogether.)
Thanks!
I agree, I don't think it's needed at all. If you need path or fs stats you can just import it yourself.
Happy to close this PR and do a new one if you just want to remove it entirely.
I think it would make sense, yep. Thanks a lot!
On Tue, May 4, 2021 at 6:48 PM Richard Davey @.***> wrote:
I agree, I don't think it's needed at all. If you need path or fs stats you can just import it yourself.
Happy to close this PR and do a new one if you just want to remove it entirely.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mihneadb/node-directory-tree/pull/87#issuecomment-832045694, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE5AN7ESTW4SSNRU6WIJCDTMAJLFANCNFSM43UW4AOQ .
-- Mihnea Dobrescu-Balaur