- Author: Jorge Feldmann
- Repo: https://github.com/jotafeldmann/code-comment-remover
- Test online: https://replit.com/@jotafeldmann/code-comment-remover#index.ts > shell > npm test > npm start
Implement a feature that removes the comments from a TypeScript code using the following interfaces.
interface ICodeCommentRemover {
trimComment(c: string): void;
}
interface ICodeWriter {
write(c: string): void;
}
The method trimComment
receives the TypeScript code char by char.
The interface ICodeWriter
may have several implementations for different outputs (text file, console). This implementation is not in the scope of your task.
Input:
// some comments
var result = a / b;
Output:
var result = a / b;
-
Install Node: install NVM then install any Node LTS >= 20
-
Local setup
npm install
- Simple run
npm start
- Run tests
npm test
- Run tests and watch for modifications
npm run test/watch