<commit_before>const _ = require('lodash');
const chance = new require('chance')();

const recordOfSpecialType = (schema) => {
    if (schema._type === 'enum') {
      return chance.pickone(schema.options);
    }
    throw new Error(`Unsupported special type: ${schema._type}`);
  };

const exampleRecord = (fieldSchema) => _.reduce(fieldSchema, (record, type, fieldName) => {
  if (Array.isArray(type)) {
    return Object.assign({}, record, { [fieldName]: [].concat(type.map(exampleRecord)) });
  }
  if (typeof type === 'object' && type !== null) {<commit_msg>mechanism for passing args to chance functions<commit_after>const _ = require('lodash');
const chance = new require('chance')();

const recordOfSpecialType = (schema) => {
    if (schema._type === 'enum') {
      return chance.pickone(schema.options);
    }
    if (chance[schema._type] && schema.args) {
      return chance[schema._type](schema.args);
    }
    throw new Error(`Unsupported special type: ${schema._type}`);
  };

const exampleRecord = (fieldSchema) => _.reduce(fieldSchema, (record, type, fieldName) => {
  if (Array.isArray(type)) {
    return Object.assign({}, record, { [fieldName]: [].concat(type.map(exampleRecord)) });
  }
  if (typeof type === 'object' && type !== null) {
{'fraction_non_alphanumeric': 0.18174603174603174, 'fraction_numerical': 0.0, 'mean_word_length': 4.320675105485232, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6097259', 'n_tokens_mistral': 386, 'n_tokens_neox': 389, 'n_words': 91}