From 1784eeb38a5409dfd051afd743bdbc540eda893c Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Fri, 19 Sep 2014 15:40:57 +0900 Subject: [PATCH] TIL: `x ? y` in CoffeeScript is a shorthand for `if x? then x else y`. --- app/assets/javascripts/map_marker.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/map_marker.js.coffee b/app/assets/javascripts/map_marker.js.coffee index 3b16daf7..146a805c 100644 --- a/app/assets/javascripts/map_marker.js.coffee +++ b/app/assets/javascripts/map_marker.js.coffee @@ -19,7 +19,7 @@ window.map_marker = (map, options = {}) -> if options.course p1 = new LatLon(pos.lat(), pos.lng()) - speed = if options.speed? then options.speed else 1 + speed = options.speed ? 1 p2 = p1.destinationPoint(options.course, Math.max(0.2, speed) * 0.1) lineCoordinates = [