<commit_before># ----------------------------------
# Store List Component
#
# containes logic for store list
# ----------------------------------

# dependencies
store_list = require '../templates/store_list.jade'
_          = require 'lodash'
$          = require 'jquery'

# component configuration
_config =
  # maps category machine name with human name
  categoryMap:
    snap : "SNAP Vendor"
    farmers_market: "Farmer's Market"
    healthy_corner_store: "Healthy Corner Store"
    wic: "WIC Vendor"

  # maps icon color with category machine name
  iconColorMap:
    healthy_corner_store : "#FF8736"
    farmers_market : "#78BB36"
    snap: '#78BB36'
    wic: '#78BB36'

# returns marker color given a store's
# category
#
# @param {string} category machine name
addMarkerColor = (category) ->
  _color = _config.iconColorMap[category]
  return _color

# formats raw distance number by rounding
# and adding units
#
# @param {float} distance
format_distance = (distance) ->
  return String(_.round(distance, 2)) + "mi"

# formats category human-friendly name
#
# @param {string} category machine name
format_category = (category) ->
  return _config.categoryMap[category]

# formats store properties for human-friendliness
#
# @param {array} store objects
module.exports.formatStores = (stores) ->
  stores.forEach (store, index, stores) ->
    # Add Icon color
    store.properties["marker-color"] = addMarkerColor store.properties.category
    # add Even/Odd property
    store.properties._count = if index % 2 == 0 then "even" else "odd"
    # format Category
    store.properties.category =
      raw: stores[index].properties.category
      formatted: format_category stores[index].properties.category
    store.properties.distance = format_distance stores[index].properties.distance
    if(window.map.getBounds().contains(store.geometry.coordinates))
      stores[index] = store
  return stores

# renders store list template with data
#
# @param {array} store objects
module.exports.render = (stores) ->
  $('#content').empty().append store_list
    stores: stores
  document.getElementById('map').style.height = "40vh"
  document.getElementById('map').style.position = "relative"
  $('#content').addClass 'results'<commit_msg>removed the default height setting for the map<commit_after># ----------------------------------
# Store List Component
#
# containes logic for store list
# ----------------------------------

# dependencies
store_list = require '../templates/store_list.jade'
_          = require 'lodash'
$          = require 'jquery'

# component configuration
_config =
  # maps category machine name with human name
  categoryMap:
    snap : "SNAP Vendor"
    farmers_market: "Farmer's Market"
    healthy_corner_store: "Healthy Corner Store"
    wic: "WIC Vendor"

  # maps icon color with category machine name
  iconColorMap:
    healthy_corner_store : "#FF8736"
    farmers_market : "#78BB36"
    snap: '#78BB36'
    wic: '#78BB36'

# returns marker color given a store's
# category
#
# @param {string} category machine name
addMarkerColor = (category) ->
  _color = _config.iconColorMap[category]
  return _color

# formats raw distance number by rounding
# and adding units
#
# @param {float} distance
format_distance = (distance) ->
  return String(_.round(distance, 2)) + "mi"

# formats category human-friendly name
#
# @param {string} category machine name
format_category = (category) ->
  return _config.categoryMap[category]

# formats store properties for human-friendliness
#
# @param {array} store objects
module.exports.formatStores = (stores) ->
  stores.forEach (store, index, stores) ->
    # Add Icon color
    store.properties["marker-color"] = addMarkerColor store.properties.category
    # add Even/Odd property
    store.properties._count = if index % 2 == 0 then "even" else "odd"
    # format Category
    store.properties.category =
      raw: stores[index].properties.category
      formatted: format_category stores[index].properties.category
    store.properties.distance = format_distance stores[index].properties.distance
    if(window.map.getBounds().contains(store.geometry.coordinates))
      stores[index] = store
  return stores

# renders store list template with data
#
# @param {array} store objects
module.exports.render = (stores) ->
  $('#content').empty().append store_list
    stores: stores
  document.getElementById('map').style.position = "relative"
  $('#content').addClass 'results'
{'fraction_non_alphanumeric': 0.13709677419354838, 'fraction_numerical': 0.008960573476702509, 'mean_word_length': 3.4919517102615694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5607551', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1246, 'n_words': 358}