How to access node field content in a custom module? I have a content type called districts and i have created the following fields


district geojson(polygon values)
harzards (list) - heavy rain, freezing rain, storm
Alert level (list) - extreme, high, low


I am displaying in a view as a leaflet map.
Now i would like to write a custom module that can get the field content of a nodes ie harzards and alert level and then pass them to a javascript file that will print specific colors to the districts in the view depending on the alert_level.

What is the best way to get the field content (harzards and alert_level) in to the custom module and then pass them to the javascript file?
Or is there another way of achieving this.
Thanks
Assuming you mean Drupal 7, just off the top of my head, implement  something like hook_node_view() and attach the Javascript via the #attached element. I am frequently silly in my hook options, so someone may have a better one to suggest.