3 ms·
With arrow function syntax, extra `maxBy` and `filter` methods on promises for arrays, and nicer file/dir libraries: Dir.glob('*').filter(f => File.isFile(f)
by spion 13y ago
With arrow function syntax, extra `maxBy` and `filter` methods on promises for arrays, and nicer file/dir libraries:
Dir.glob('*').filter(f => File.isFile(f)).maxBy(f => File.size(f));
Asynchronicity isn't the issue there, the issue is that most JS / node libraries are minimal, not optimized for ergonomic (and of course the verbose lambda syntax)