jaysylvester / citizen

Node.js MVC web application framework. Includes routing, serving, caching, session management, and other helpful tools.
MIT License
100 stars 7 forks source link

Refactor logic to use option chaining #124

Closed jaysylvester closed 4 months ago

jaysylvester commented 5 months ago

Much of citizen was written before node supported option chaining, so there's lots of this:

if ( something && something.else && something.else.goes && something.else.goes.here ) { doSomething() }

The cache module is particularly bad. Could use some cleanup.

if ( something?.else?.goes?.here ) { doSomething() }

jaysylvester commented 4 months ago

Made these optimizations across a few unrelated commits. Should be addressed pretty much everywhere.