From 3b927075a485b2eca0c4113dca2e5f16c46488ff Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Fri, 6 Mar 2015 19:38:49 -0800 Subject: [PATCH] simplify boolean assignment The requestMetric function is only called once, and it just does a simple boolean equality check. It would be cleaner to just inline the check. --- lib/pebble.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/pebble.js b/lib/pebble.js index d8ea2f716..7f5e8e64a 100644 --- a/lib/pebble.js +++ b/lib/pebble.js @@ -21,17 +21,9 @@ function directionToTrend (direction) { function pebble (req, res) { var ONE_DAY = 24 * 60 * 60 * 1000; + var useMetricBg = (req.query.units === "mmol"); var uploaderBattery; - function requestMetric() { - var units = req.query.units; - if (units == "mmol") { - return true; - } - return false; - } - var useMetricBg = requestMetric(); - function scaleBg(bg) { if (useMetricBg) { return (Math.round((bg / 18) * 10) / 10).toFixed(1);