text: var util = require('../util');
  var type = require('./type');
  var formats = require('./formats');
  
  function read(data, format) {
    var type = (format && format.type) || 'json';
    data = formats[type](data, format);
    if (format && format.parse) parse(data, format.parse);
    return data;
  }
  
  function parse(data, types) {
    var cols, parsers, d, i, j, clen, len = data.length;
  
    types = (types==='auto') ? type.inferAll(data) : util.duplicate(types);
    cols = util.keys(types);
    parsers = cols.map(function(c) { return type.parsers[types[c]]; });
  
    for (i=0, clen=cols.length; i<len; ++i) {
      d = data[i];
      for (j=0; j<clen; ++j) {
        d[cols[j]] = parsers[j](d[cols[j]]);
      }
    }
    type.annotation(data, types);
  }
  
  read.formats = formats;
  module.exports = read;
  