Rudloff / openvegemap

Find vegetarian and vegan restaurants in your city
https://openvegemap.netlib.re/
GNU General Public License v3.0
72 stars 9 forks source link

Generalize OK/not-OK logic for POIs tags. #100

Closed maytransfer closed 3 years ago

maytransfer commented 3 years ago

This commit creates two little shim functions called isOK and isNotOK that check a given element's tag values for either yes or only in the case of the former function and for the presence of a no tag value in the case of the latter. These two functions can then be called by isDiet() and isNotDiet() directly without changing the logic or interface of the rest of the project. So what's the point?

By including these additional more generic methods, code can be more easily reused for other elements, such as for whether an element has a toilets:unisex=yes tag or other such value either in the future in this own codebase or in forked codebases such as the (new!) OpenToiletMap project, which is forked from here.

maytransfer commented 3 years ago

I added some suggestions to improve the code.

Thanks for the suggestions! I applied them all. :)