<commit_before>/**
 * @author <NAME> <<EMAIL>>
 * @copyright 2014 Sazze, Inc.
 */

var _ = require('lodash');
var client = require('request');
var async = require('async');

var AURA_DEFINED = !_.isUndefined(global.aura);

var log = (!AURA_DEFINED || _.isUndefined(global.aura.log) ? {error: console.error, warn: console.warn, info: console.info, debug: _.noop, verbose: _.noop} : global.aura.log);

function Riak(bucket) {
  this.bucket = bucket;
  this.host = process.env.SZ_RIAK_HOST || (AURA_DEFINED && !_.isUndefined(global.aura.config.riak) ? global.aura.config.riak.host : '127.0.0.1');
  this.port = process.env.SZ_RIAK_PORT || (AURA_DEFINED && !_.isUndefined(global.aura.config.riak) ? global.aura.config.riak.port : 8098);
}

Riak.ASYNC_LIMIT = 20;

//
// static methods
//

Riak.parseHeaders = function (headers) {
  var properties = {
    vclock: '',
    links: [],
    meta: {},
    index: {},
    contentType: ''
  };

  if (_.isEmpty(headers)) {
    return properties;
  }

  _.forEach(headers, function (val, name) {
    switch (name.toLowerCase()) {
      case 'content-type':<commit_msg>allow ASYNC_LIMIT to be configurable via the SZ_RIAK_ASYNC_LIMIT environment variable<commit_after>/**
 * @author <NAME> <<EMAIL>>
 * @copyright 2014 Sazze, Inc.
 */

var _ = require('lodash');
var client = require('request');
var async = require('async');

var AURA_DEFINED = !_.isUndefined(global.aura);

var log = (!AURA_DEFINED || _.isUndefined(global.aura.log) ? {error: console.error, warn: console.warn, info: console.info, debug: _.noop, verbose: _.noop} : global.aura.log);

function Riak(bucket) {
  this.bucket = bucket;
  this.host = process.env.SZ_RIAK_HOST || (AURA_DEFINED && !_.isUndefined(global.aura.config.riak) ? global.aura.config.riak.host : '127.0.0.1');
  this.port = process.env.SZ_RIAK_PORT || (AURA_DEFINED && !_.isUndefined(global.aura.config.riak) ? global.aura.config.riak.port : 8098);
}

Riak.ASYNC_LIMIT = process.env.SZ_RIAK_ASYNC_LIMIT || 20;

//
// static methods
//

Riak.parseHeaders = function (headers) {
  var properties = {
    vclock: '',
    links: [],
    meta: {},
    index: {},
    contentType: ''
  };

  if (_.isEmpty(headers)) {
    return properties;
  }

  _.forEach(headers, function (val, name) {
    switch (name.toLowerCase()) {
      case 'content-type':
{'fraction_non_alphanumeric': 0.1735002157962883, 'fraction_numerical': 0.013810962451445835, 'mean_word_length': 3.8291666666666666, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7667563', 'n_tokens_mistral': 902, 'n_tokens_neox': 842, 'n_words': 161}