<commit_before>'use strict';

var $ = require('./uri-helpers');

var find = require('./find-reference');

var deepExtend = require('deep-extend');

function copy(obj, refs, parent, resolve) {
  var target =  Array.isArray(obj) ? [] : {};

  if (typeof obj.$ref === 'string') {
    var base = $.getDocumentURI(obj.$ref);

    if (parent !== base || (resolve && obj.$ref.indexOf('#/') > -1)) {
      var fixed = find(obj.$ref, refs);

      deepExtend(obj, fixed);

      delete obj.$ref;
      delete obj.id;
    }
  }

  for (var prop in obj) {
    var value = obj[prop];

    if (typeof value === 'object' && !(prop === 'enum' || prop === 'required')) {
      target[prop] = copy(value, refs, parent, resolve);
    } else {
      target[prop] = value;
    }
  }
<commit_msg>Skip definitions on resolveSchema() calls; fix<commit_after>'use strict';

var $ = require('./uri-helpers');

var find = require('./find-reference');

var deepExtend = require('deep-extend');

function isKey(prop) {
  return prop === 'enum' || prop === 'required' || prop === 'definitions';
}

function copy(obj, refs, parent, resolve) {
  var target =  Array.isArray(obj) ? [] : {};

  if (typeof obj.$ref === 'string') {
    var base = $.getDocumentURI(obj.$ref);

    if (parent !== base || (resolve && obj.$ref.indexOf('#/') > -1)) {
      var fixed = find(obj.$ref, refs);

      deepExtend(obj, fixed);

      delete obj.$ref;
      delete obj.id;
    }
  }

  for (var prop in obj) {
    if (typeof obj[prop] === 'object' && !isKey(prop)) {
      target[prop] = copy(obj[prop], refs, parent, resolve);
    } else {
      target[prop] = obj[prop];
    }
  }

{'fraction_non_alphanumeric': 0.20195241000610129, 'fraction_numerical': 0.0012202562538133007, 'mean_word_length': 2.9423076923076925, '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': '90213', 'n_tokens_mistral': 552, 'n_tokens_neox': 545, 'n_words': 138}