{"action":"opened","issue":{"url":"https://api.github.com/repos/smartercleanup/duwamish/issues/264","repository_url":"https://api.github.com/repos/smartercleanup/duwamish","labels_url":"https://api.github.com/repos/smartercleanup/duwamish/issues/264/labels{/name}","comments_url":"https://api.github.com/repos/smartercleanup/duwamish/issues/264/comments","events_url":"https://api.github.com/repos/smartercleanup/duwamish/issues/264/events","html_url":"https://github.com/smartercleanup/duwamish/issues/264","id":133373138,"number":264,"title":"Evaluate conditions in config without using `eval`","user":{"login":"LukeSwart","id":4207017,"avatar_url":"https://avatars.githubusercontent.com/u/4207017?v=3","gravatar_id":"","url":"https://api.github.com/users/LukeSwart","html_url":"https://github.com/LukeSwart","followers_url":"https://api.github.com/users/LukeSwart/followers","following_url":"https://api.github.com/users/LukeSwart/following{/other_user}","gists_url":"https://api.github.com/users/LukeSwart/gists{/gist_id}","starred_url":"https://api.github.com/users/LukeSwart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LukeSwart/subscriptions","organizations_url":"https://api.github.com/users/LukeSwart/orgs","repos_url":"https://api.github.com/users/LukeSwart/repos","events_url":"https://api.github.com/users/LukeSwart/events{/privacy}","received_events_url":"https://api.github.com/users/LukeSwart/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-12T23:57:22Z","updated_at":"2016-02-12T23:57:22Z","closed_at":null,"body":"We have a cool feature that can change the styles of our layers through the config, using a `condition` property, like this: ` - condition: '{{map.zoom}} >= 14'` (shown here: https://github.com/smartercleanup/duwamish/blob/master/src/flavors/duwamish_flavor/config.yml#L390)\r\n\r\nUnfortunately, we are using a javascript `eval` statement to evaluate the conditional, and it greatly slows down our map. This can be seen every time the map loads, or the zoom changes on the map. Here is the eval statement: https://github.com/smartercleanup/duwamish/blob/master/src/sa_web/static/libs/leaflet.argo.js#L186\r\n\r\nInstead of evaluating that string literal, instead we can load a javascript function into that config YAML file (which eventually get processed into a Python dict, then a javascript object). I am still not sure exactly how the solution will work, but any suggestions are welcome!"}}