<commit_before>
function _notImplemented() {
  throw new Error('Not implemtend');
}

/**
 * Support us in the nine circles of hell which is json-schema
 */
export default class Schema {
  constructor(jsonSchema, parent, path) {
    this._schema = jsonSchema;
    this._root = parent ? parent._root : this;
    this._parent = parent;
    this._pathFromParent = path;
  }

  _getCurrentSchema(path) {
    let result = this._schema;
    if (path && path.length !== 0) {
      result = result.properties[path];
    }
    return result;
  }

  getType(path) {
    return this._getCurrentSchema(path).type;
  }

  getRoot() {
    return this._root;
  }

  getSchema(path) {
    const pathedSchema = this._getCurrentSchema(path);
    let result;
    if (pathedSchema === this) {
      result = this;
    } else {
      // root
      result = new Schema(pathedSchema, this, path);
    }
    return result;
  }

  getProperties(path) {
    if (!this.isObject(path)) {
      throw new Error(`Properties only exist in object, this is ${this.getType(path)}`);
    }
    const schema = this._getCurrentSchema(path);
    return schema.properties;
  }

  isRef(path) {
    _notImplemented(path);
  }

  isObject(path) {
    return this.isType(path, 'object');
  }

  isArray(path) {
    return this.isType(path, 'array');
  }
<commit_msg>added getters to schema.js<commit_after>
function _notImplemented() {
  throw new Error('Not implemtend');
}

/**
 * Support us in the nine circles of hell which is json-schema
 */
export default class Schema {
  constructor(jsonSchema, parent, path) {
    this._schema = jsonSchema;
    this._root = parent ? parent._root : this;
    this._parent = parent;
    this._pathFromParent = path;
  }

  _getCurrentSchema(path) {
    let result = this._schema;
    if (path && path.length !== 0) {
      result = result.properties[path];
    }
    return result;
  }

  getType(path) {
    return this._getCurrentSchema(path).type;
  }

  getParent() {
    return this._parent;
  }
  
  getPathFromParent() {
    return this._pathFromParent;
  }

  getRoot() {
    return this._root;
  }

  getSchema(path) {
    const pathedSchema = this._getCurrentSchema(path);
    let result;
    if (pathedSchema === this) {
      result = this;
    } else {
      result = new Schema(pathedSchema, this, path);
    }
    return result;
  }

  getProperties(path) {
    if (!this.isObject(path)) {
      throw new Error(`Properties only exist in object, this is ${this.getType(path)}`);
    }
    const schema = this._getCurrentSchema(path);
    return schema.properties;
  }

  isRef(path) {
    _notImplemented(path);
  }

  isObject(path) {
    return this.isType(path, 'object');
  }

  isArray(path) {
    return this.isType(path, 'array');
  }

{'fraction_non_alphanumeric': 0.1266787658802178, 'fraction_numerical': 0.0007259528130671506, 'mean_word_length': 2.865357643758766, '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': '2717731', 'n_tokens_mistral': 896, 'n_tokens_neox': 888, 'n_words': 210}