<commit_before>
import bbox from '@turf/bbox';

/**
 * given a feature collection, returns a mapboxgl geojson feature collection object
 * @func generateSourceFC
 * @param {object} fc feature collection
 * @return {object} mapboxgl object
 */
export function generateSourceFC (fc) {
  // layer spec per this tutorial -> https://www.mapbox.com/mapbox-gl-js/example/multiple-geometries/
  return {
    'type': 'geojson',
    'data': fc
  };
}

/**
 * given a source id, fieldDataSOurce, and vprommsId, generate a unique mapboxgl layer object used to add given feature
 * to mapboxgl map.
 * @func generateLayer
 * @param {object} sourceId mapboxgl source id given for layer's source
 * @param {string} fieldDataSource name of the field data's source, either RoadLabPro, or RouteShoot
 * @param {vprommId} vprommId road's vprommsId. here used to generate part of the layer's id
 * @return {object} layer object used to add layers to mapboxgl map
 */
export function generateLayer (sourceId, fieldDataSource, vprommId) {
  console.log(fieldDataSource);
  return {
    'id': `${vprommId}-${fieldDataSource}-field-data`,
    'type': 'circle',
    'source': sourceId,
    'paint': {
      'circle-radius': 6,
      'circle-color': sourceId === 'RoadLabPro' ? 'red' : 'green'
    },
    'filter': ['==', 'source', fieldDataSource]
  };
}

/**
 * given a feature collection, returns boudns used to set field data map zoom
 * @param {object} fc feature collection
 * @return {array} bounding box array
 */
export function generateBbox (fc) {
  return bbox(fc);
}<commit_msg>update layer generation for type line. also style per lineColors util<commit_after>
import bbox from '@turf/bbox';
import lineColors from './line-colors';

/**
 * given a feature collection, returns a mapboxgl geojson feature collection object
 * @func generateSourceFC
 * @param {object} fc feature collection
 * @return {object} mapboxgl object
 */
export function generateSourceFC (fc) {
  // layer spec per this tutorial -> https://www.mapbox.com/mapbox-gl-js/example/multiple-geometries/
  return {
    'type': 'geojson',
    'data': fc
  };
}

/**
 * given a source id, fieldDataSOurce, and vprommsId, generate a unique mapboxgl layer object used to add given feature
 * to mapboxgl map.
 * @func generateLayer
 * @param {object} sourceId mapboxgl source id given for layer's source
 * @param {string} fieldDataSource name of the field data's source, either RoadLabPro, or RouteShoot
 * @param {vprommId} vprommId road's vprommsId. here used to generate part of the layer's id
 * @return {object} layer object used to add layers to mapboxgl map
 */
export function generateLayer (sourceId, fieldDataSource, vprommId) {
  console.log(fieldDataSource);
  return {
    'id': `${vprommId}-${fieldDataSource}-field-data`,
    'type': 'line',
    'source': sourceId,
    'paint': {
      'line-width': 2,
      'line-color': lineColors[fieldDataSource].stops[1]
    },
    'filter': ['==', 'source', fieldDataSource]
  };
}

/**
 * given a feature collection, returns boudns used to set field data map zoom
 * @param {object} fc feature collection
 * @return {array} bounding box array
 */
export function generateBbox (fc) {
  return bbox(fc);
}
{'fraction_non_alphanumeric': 0.11993769470404984, 'fraction_numerical': 0.0009345794392523365, 'mean_word_length': 4.04874213836478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '393939', 'n_tokens_mistral': 988, 'n_tokens_neox': 971, 'n_words': 345}