underscore_to_camelCase
Pointy haired boss decided we need to switch to camelCase. Let's get this over with.
Start file
log(req, res, next) { try { let ratio = this.config.get("HEADER_LOG_FREQ", 0.05); if (Math.random() < ratio) { this.arrange_headers(req, res).then(this.write_log); } let safe_path = this.safe_graphite_path(req.path); this.stats.increment("web.endpoint." + safe_path, 1, 0.05); if (req.headers && req.headers["x-forwarded-proto"]) { this.stats.increment("web.protocol." + req.headers["x-forwarded-proto"], 1, 0.05); } } catch (error) { log.warning(error, "Failed to log headers"); res.status(500).send("its_not_you_its_me"); } finally { next(); } }
End file
log(req, res, next) { try { let ratio = this.config.get("HEADER_LOG_FREQ", 0.05); if (Math.random() < ratio) { this.arrangeHeaders(req, res).then(this.writeLog); } let safePath = this.safeGraphitePath(req.path); this.stats.increment("web.endpoint." + safePath, 1, 0.05); if (req.headers && req.headers["x-forwarded-proto"]) { this.stats.increment("web.protocol." + req.headers["x-forwarded-proto"], 1, 0.05); } } catch (error) { log.warning(error, "Failed to log headers"); res.status(500).send("its_not_you_its_me"); } finally { next(); } }
View Diff
5c5 < this.arrange_headers(req, res).then(this.write_log); --- > this.arrangeHeaders(req, res).then(this.writeLog); 7,8c7,8 < let safe_path = this.safe_graphite_path(req.path); < this.stats.increment("web.endpoint." + safe_path, 1, 0.05); --- > let safePath = this.safeGraphitePath(req.path); > this.stats.increment("web.endpoint." + safePath, 1, 0.05);
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 81 remaining solutions by signing in and submitting your own entry
#82 Sebastian Pfluegelm / @sebastian_pflgl - Score: 35 - 06/04/16 @ 22:31
/_n<BS><CR>nnxrHnxRL<Esc>nxrPnxrGnxrPnxrP:wq<CR>
0 comments