byuitechops / action-series-master

The master module for all of the action-series child modules.
3 stars 0 forks source link

Betterize IF statement #29

Closed zachintosh closed 6 years ago

zachintosh commented 6 years ago

https://github.com/byuitechops/action-series-master/blob/6242a2ffc0f996c03860c1fecf92d3674e47ac5e/actions/universal-fix-dropbox-links.js#L163-L164

Make sure to use !== instead of !=. Using != will typecast to see if it is equal, which slows it down. You can also switch typeof $(link).attr('href') != "undefined" to just $(link).attr('href') !== undefined. You may be able to just switch this whole if statement to check if $(link).attr('href') is truthy. I'm not sure what cheerio spits out if it doesn't have an href attribute.

csammcgrath commented 6 years ago

Fixed with the latest pull request.