TODO comments.

This commit is contained in:
dumitru.deveatii 2019-02-09 22:31:00 +02:00
parent 07c68cbe9f
commit f0ba673e71

View file

@ -2568,3 +2568,31 @@ class Client {
```
**[ back to top](#table-of-contents)**
### TODO comments
When you find yourself that you need to leave notes in the code for some later improvements,
do that using `// TODO` comments. Most IDE have special support for those kind of comments so that
you can quickly go over the entire list of todos.
Keep in mind however that a *TODO* comment is not an excuse for bad code.
**Bad:**
```ts
function getActiveSubscriptions(): Promise<Subscription[]> {
// ensure `dueDate` is indexed.
return db.subscriptions.find({ dueDate: { $lte: new Date() } });
}
```
**Good**
```ts
function getActiveSubscriptions(): Promise<Subscription[]> {
// TODO: ensure `dueDate` is indexed.
return db.subscriptions.find({ dueDate: { $lte: new Date() } });
}
```
**[ back to top](#table-of-contents)**