<commit_before>/**
 * Return the model specific utility object
 * @param {object} modelOrDomain: the model object or entityType state object (if model `id` is provided)
 * @param {string} id: the model id if `modelOrDomain` represents the entityType state object
 */
export default class Model {
  constructor (options, value) {
    let entities;
    let id;
    let entityType;
    let meta;
    if (value) {
      // (id, value)
      id = options;
      options = undefined;
      meta = value._meta;
      options = {};
    } else {
      // (options)
      id = options.id;
      entities = options.entities;
      entityType = options.entityType;
      value = deepValue(entities, [entityType, id]);
      meta = deepValue(entities, ['_meta', entityType, id]);
    }

    this.id = id;
    this._entities = entities ? entities.entities || entities : entities;
    this._value = value;
    this._options = options;
    this._meta = meta || {};
    this._metadata = this._meta.data || {};
  }

  data () {
    return this._metadata;
  }

  /**
   * Return the (optionally formatted) model data
   */<commit_msg>allow root state to be passed to model instead of state.entities<commit_after>/**
 * Return the model specific utility object
 * @param {object} modelOrDomain: the model object or entityType state object (if model `id` is provided)
 * @param {string} id: the model id if `modelOrDomain` represents the entityType state object
 */
export default class Model {
  constructor (options, value) {
    let entities;
    let id;
    let entityType;
    let meta;
    if (value) {
      // (id, value)
      id = options;
      options = undefined;
      meta = value._meta;
      options = {};
    } else {
      // (options)
      id = options.id;
      entities = options.entities;
      if (entities) {
        // allow for root state to be passed
        entities = entities.entities || entities;
      }
      entityType = options.entityType;
      value = deepValue(entities, [entityType, id]);
      meta = deepValue(entities, ['_meta', entityType, id]);
    }

    this.id = id;
    this._entities = entities;
    this._value = value;
    this._options = options;
    this._meta = meta || {};
    this._metadata = this._meta.data || {};
  }

  data () {
    return this._metadata;
  }

  /**
   * Return the (optionally formatted) model data
   */
{'fraction_non_alphanumeric': 0.11807024968260686, 'fraction_numerical': 0.0, 'mean_word_length': 2.512630014858841, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7504842', 'n_tokens_mistral': 679, 'n_tokens_neox': 685, 'n_words': 223}