<commit_before>
function insert(table, options, callback) {

  var foreignLinkage = this.foreignLinkage[table];

  for(var o = 0; o < options.length; ++o)
  {
    var option = Object.keys(options[o]);

    for(var i = 0; i < option.length; ++i) {

      if (typeof(options[option]) === 'object') {

        if (options[option].type === 'loockup') {

          if (!options[option].table) {

            if (foreignLinkage[option]) {

              options[option].table = foreignLinkage[option].table;
              options[option].field = foreignLinkage[option].field;
            }
            else {

              callback('missing foreign key linkage!', null);
            }
          }
        }
      }
    }
  }

  return loockup(options)
  .catch(callback)
  .then(function(){

    return this.driver.massInsert(options);
  })
  .catch(callback)
  .nodeify(callback);
}<commit_msg>partial lookup<commit_after>var Promise = require('bluebird');

function insert(table, options, callback) {

  var foreignLinkage = this.foreignLinkage[table];

  for(var o = 0; o < options.length; ++o)
  {
    var option = Object.keys(options[o]);

    for(var i = 0; i < option.length; ++i) {

      if (typeof(options[option]) === 'object') {

        if (options[option].type === 'lookup') {

          if (!options[option].table) {

            if (foreignLinkage[option]) {

              options[option].table = foreignLinkage[option].table;
              options[option].field = foreignLinkage[option].field;
            }
            else {

              callback('missing foreign key linkage!', null);
            }
          }
        }
      }
    }
  }

  return lookup(options, 0)
  .catch(callback)
  .then(function(){

    return this.driver.massInsert(options);
  })
  .catch(callback)
  .nodeify(callback);
}

function lookup(options, i, callback) {


  for(var o = 0; o < options.length; ++o)
  {
    var option = Object.keys(options[o]);

    for(; i < option.length; ++i) {

      if (typeof(options[option]) === 'object') {

        if (options[option].type === 'lookup') {

          return this.driver.lookup(options[option])
          .catch(function(err) {

            console.log(err);
          })
          .then(function() {

            if(i + 1 < option.length)
              return loockup(options, i);
            else
              return options;
          })
          .nodeify(callback);
        }
      }
    }
  }
}

{'fraction_non_alphanumeric': 0.14950980392156862, 'fraction_numerical': 0.0028594771241830064, 'mean_word_length': 2.0085995085995085, 'pattern_counts': {'":': 0, '<': 10, '<?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': '3723775', 'n_tokens_mistral': 769, 'n_tokens_neox': 724, 'n_words': 144}