Skip to content

Commit

Permalink
fs: refactoring declaratively with the fromAsync function
Browse files Browse the repository at this point in the history
  • Loading branch information
sonsurim committed Aug 29, 2024
1 parent e70bd47 commit 4dd3a9e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3115,10 +3115,7 @@ function glob(pattern, options, callback) {
// TODO: Use iterator helpers when available
(async () => {
try {
const res = [];
for await (const entry of new Glob(pattern, options).glob()) {
ArrayPrototypePush(res, entry);
}
const res = await Array.fromAsync(new Glob(pattern, options).glob());
callback(null, res);
} catch (err) {
callback(err);
Expand Down

0 comments on commit 4dd3a9e

Please sign in to comment.