<commit_before>import optionAPI from '../api/option';
import env from './constants';
import random from './random';

function getLocalRef(obj, path, refs) {
  const keyElements = path.replace('#/', '/').split('/');

  let schema = obj.$ref && refs ? refs[obj.$ref] : obj;
  if (refs && path.includes('#/') && refs[keyElements[0]]) {
    schema = refs[keyElements.shift()];
  }

  if (!keyElements[0]) keyElements.shift();

  while (schema && keyElements.length > 0) {
    const prop = keyElements.shift();

    if (!schema[prop]) {
      throw new Error(`Prop not found: ${prop} (${path})`);<commit_msg>fix: allow to resolve from given refs too<commit_after>import optionAPI from '../api/option';
import env from './constants';
import random from './random';

function getLocalRef(obj, path, refs) {
  if (refs && refs[path]) return clone(refs[path]); // eslint-disable-line

  const keyElements = path.replace('#/', '/').split('/');

  let schema = obj.$ref && refs ? refs[obj.$ref] : obj;
  if (refs && path.includes('#/') && refs[keyElements[0]]) {
    schema = refs[keyElements.shift()];
  }

  if (!keyElements[0]) keyElements.shift();

  while (schema && keyElements.length > 0) {
    const prop = keyElements.shift();

    if (!schema[prop]) {
      throw new Error(`Prop not found: ${prop} (${path})`);
{'fraction_non_alphanumeric': 0.2, 'fraction_numerical': 0.004580152671755725, 'mean_word_length': 3.9101123595505616, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5178518', 'n_tokens_mistral': 426, 'n_tokens_neox': 416, 'n_words': 114}