text: (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.dbf = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  var fieldSize = require('./fieldsize');
  
  var types = {
      string: 'C',
      number: 'N',
      boolean: 'L',
      // type to use if all values of a field are null
      null: 'C'
  };
  
  module.exports.multi = multi;
  module.exports.bytesPer = bytesPer;
  module.exports.obj = obj;
  
  function multi(features) {
      var fields = {};
      features.forEach(collect);
      function collect(f) { inherit(fields, f); }
      return obj(fields);
  }
  
  /**
   * @param {Object} a
   * @param {Object} b
   * @returns {Object}
   */
  function inherit(a, b) {
      for (var i in b) {
          var isDef = typeof b[i] !== 'undefined' && b[i] !== null;
          if (typeof a[i] === 'undefined' || isDef) {
            a[i] = b[i];
          }
      }
      return a;
  }
  
  function obj(_) {
      var fields = {}, o = [];
      for (var p in _) fields[p] = _[p] === null ? 'null' : typeof _[p];
      for (var n in fields) {
          var t = types[fields[n]];
          if(t){
               o.push({
                  name: n,
                  type: t,
                  size: fieldSize[t]
              });
          }
      }
      return o;
  }
  
  /**
   * @param {Array} fields
   * @returns {Array}
   */
  function bytesPer(fields) {
      // deleted flag
      return fields.reduce(function(memo, f) { return memo + f.size; }, 1);
  }
  
  },{"./fieldsize":2}],2:[function(require,module,exports){
  module.exports = {
      // string
      C: 254,
      // boolean
      L: 1,
      // date
      D: 8,
      // number
      N: 18,
      // number
      M: 18,
      // number, float
      F: 18,
      // number
      B: 8,
  };
  
  },{}],3:[function(require,module,exports){
  /**
   * @param {string} str
   * @param {number} len
   * @param {string} char
   * @returns {string}
   */
  module.exports.lpad = function lpad(str, len, char) {
      while (str.length < len) { str = char + str; } return str;
  };
  
  /**
   * @param {string} str
   * @param {number} len
   * @param {string} char
   * @returns {string}
   */
  module.exports.rpad = function rpad(str, len, char) {
      while (str.length < len) { str = str + char; } return str;
  };
  
  /**
   * @param {object} view
   * @param {number} fieldLength
   * @param {string} str
   * @param {number} offset
   * @returns {number}
   */
  module.exports.writeField = function writeField(view, fieldLength, str, offset) {
      for (var i = 0; i < fieldLength; i++) {
          view.setUint8(offset, str.charCodeAt(i)); offset++;
      }
      return offset;
  };
  
  },{}],4:[function(require,module,exports){
  var fieldSize = require('./fieldsize'),
      lib = require('./lib'),
      fields = require('./fields');
  
  /**
   * @param {Array} data
   * @param {Array} meta
   * @returns {Object} view
   */
  module.exports = function structure(data, meta) {
  
      var field_meta = meta || fields.multi(data),
          fieldDescLength = (32 * field_meta.length) + 1,
          bytesPerRecord = fields.bytesPer(field_meta), // deleted flag
          buffer = new ArrayBuffer(
              // field header
              fieldDescLength +
              // header
              32 +
              // contents
              (bytesPerRecord * data.length) +
              // EOF marker
              1
      ),
          now = new Date(),
          view = new DataView(buffer);
  
      // version number - dBase III
      view.setUint8(0, 0x03);
      // date of last update
      view.setUint8(1, now.getFullYear() - 1900);
      view.setUint8(2, now.getMonth());
      view.setUint8(3, now.getDate());
      // number of records
      view.setUint32(4, data.length, true);
  
      // length of header
      var headerLength = fieldDescLength + 32;
      view.setUint16(8, headerLength, true);
      // length of each record
      view.setUint16(10, bytesPerRecord, true);
  
      // Terminator
      view.setInt8(32 + fieldDescLength - 1, 0x0D);
  
      field_meta.forEach(function(f, i) {
          // field name
          f.name.split('').slice(0, 10).forEach(function(c, x) {
              view.setInt8(32 + i * 32 + x, c.charCodeAt(0));
          });
          // field type
          view.setInt8(32 + i * 32 + 11, f.type.charCodeAt(0));
          // field length
          view.setInt8(32 + i * 32 + 16, f.size);
          if (f.type == 'N') view.setInt8(32 + i * 32 + 17, 3);
      });
  
      var offset = fieldDescLength + 32;
  
      data.forEach(function(row, num) {
          // delete flag: this is not deleted
          view.setUint8(offset, 32);
          offset++;
          field_meta.forEach(function(f) {
              var val = row[f.name];
              if (val === null || typeof val === 'undefined') val = '';
  
              switch (f.type) {
                  // boolean
                  case 'L':
                      view.setUint8(offset, val ? 84 : 70);
                      offset++;
                      break;
  
                  // date
                  case 'D':
                      offset = lib.writeField(view, 8,
                          lib.lpad(val.toString(), 8, ' '), offset);
                      break;
  
                  // number
                  case 'N':
                      offset = lib.writeField(view, f.size,
                          lib.lpad(val.toString(), f.size, ' ').substr(0, 18),
                          offset);
                      break;
  
                  // string
                  case 'C':
                      offset = lib.writeField(view, f.size,
                          lib.rpad(val.toString(), f.size, ' '), offset);
                      break;
  
                  default:
                      throw new Error('Unknown field type');
              }
          });
      });
  
      // EOF flag
      view.setUint8(offset, 0x1A);
  
      return view;
  };
  
  },{"./fields":1,"./fieldsize":2,"./lib":3}],5:[function(require,module,exports){
  module.exports.structure = require('./src/structure');
  
  },{"./src/structure":4}]},{},[5])(5)
  });
  