Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 956 Bytes

File metadata and controls

16 lines (12 loc) · 956 Bytes

Problem Statement

Your local supermarket "Please Buy?" has gone entirely digital. They maintain logs, receipts, and everything else on a computer. Despite the IT guy’s best effort, the files and folders are getting messy and things get lost. Given this problem, the IT guy wrote a program that gets directories of files and the line number within those files for a certain string token. The IT guy implemented a functional, but slow, synchronous solution. To boost your ego, you decide to re-write the program in JavaScript to make it faster via asynchronous programming.

Task

Use your JavaScript knowledge to implement the solution. When given the path to a directory and target string token, it should return an object with keys as pathname and values as an array of line numbers in which the string token matches. The solution will leverage asynchronous programming.

Keeping the complexity of directories in mind, provide a solution to this task.