cloudhead / node-static

rfc 2616 compliant HTTP static-file server module, with built-in caching.
MIT License
2.17k stars 245 forks source link

Update node-static.js #151

Closed sdenel closed 7 years ago

sdenel commented 9 years ago

Change based on a JSLint advice, and on this thread: http://stackoverflow.com/questions/13632999/if-key-in-object-or-ifobject-hasownpropertykey See also a speed test: http://andrew.hedges.name/experiments/in/

Mattijah commented 9 years ago

This is pretty pointless in this case.

So for example this

if ('cache' in this.options) {
    if (typeof(this.options.cache) === 'number') {
        this.cache = this.options.cache;
    } else if (! this.options.cache) {
        this.cache = false;
    }
 }

could be

if (typeof this.options.cache === 'number' || this.options.cache === false) {
   this.cache = this.options.cache;
}