[gnome-maps/wip/mlundblad/add-email-and-takeaway: 3/4] place: Add boolean read-only property for eating & drinking




commit e559fb10b6a0e7b2237da46234986a1f7b00f044
Author: Marcus Lundblad <ml update uu se>
Date:   Fri Apr 30 23:06:12 2021 +0200

    place: Add boolean read-only property for eating & drinking

 src/place.js | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/place.js b/src/place.js
index 821ffb10..1545e819 100644
--- a/src/place.js
+++ b/src/place.js
@@ -297,6 +297,16 @@ class Place extends Geocode.Place {
         return PlaceIcons.getIconForPlace(this);
     }
 
+    /**
+     * This property is true for places related to eating and/or drinking,
+     * such as restaurants, cafes, pubs and similar
+     */
+    get eatingAndDrinking() {
+        return this._osmKey === 'amenity' &&
+               ['restaurant', 'fast_food', 'food_court', 'bar', 'cafe', 'pub'].
+               indexOf(this._osmValue) !== -1;
+    }
+
     toJSON() {
         let bounding_box = null;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]