<commit_before>import { scaleLinear } from 'd3-scale';

// Services
import { pubSub } from './services';

export class Track {
  constructor() {
    this._xScale = scaleLinear();
    this._yScale = scaleLinear();

    // reference scales used for tracks that can translate and scale
    // their graphics
    // They will draw their graphics on the reference scales and then translate
    // and pan them as needed
    this._refXScale = scaleLinear();
    this._refYScale = scaleLinear();

    this.position = [0, 0];
    this.dimensions = [1, 1];
    this.options = {};
    this.pubSubs = [];
  }

  /**
   * Check if a 2d location (x, y) is within the bounds of this track.
   *
   * @param {Number}  x  X position to be tested.
   * @param {Number}  y  Y position to be tested.
   * @return {Boolean}  If `true` location is within the track.
   */
  isWithin(x, y) {
    const withinX = x >= this.position[0] && x <= this.dimensions[0] + this.position[0];
    const withinY = y >= this.position[1] && y <= this.dimensions[1] + this.position[1];
    return withinX && withinY;
  }

  getData() {}<commit_msg>Add a helper method to create a function to get any prop<commit_after>import { scaleLinear } from 'd3-scale';

// Services
import { pubSub } from './services';

export class Track {
  constructor() {
    this._xScale = scaleLinear();
    this._yScale = scaleLinear();

    // reference scales used for tracks that can translate and scale
    // their graphics
    // They will draw their graphics on the reference scales and then translate
    // and pan them as needed
    this._refXScale = scaleLinear();
    this._refYScale = scaleLinear();

    this.position = [0, 0];
    this.dimensions = [1, 1];
    this.options = {};
    this.pubSubs = [];
  }

  /**
   * Check if a 2d location (x, y) is within the bounds of this track.
   *
   * @param {Number}  x  X position to be tested.
   * @param {Number}  y  Y position to be tested.
   * @return {Boolean}  If `true` location is within the track.
   */
  isWithin(x, y) {
    const withinX = x >= this.position[0] && x <= this.dimensions[0] + this.position[0];
    const withinY = y >= this.position[1] && y <= this.dimensions[1] + this.position[1];
    return withinX && withinY;
  }

  getProp(prop) {
    return () => this[prop];
  }

  getData() {}
{'fraction_non_alphanumeric': 0.13347732181425487, 'fraction_numerical': 0.010367170626349892, 'mean_word_length': 2.771986970684039, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '6773270', 'n_tokens_mistral': 737, 'n_tokens_neox': 719, 'n_words': 248}