src/DRS.js
function DRS (file) {
  if (!(this instanceof DRS)) return new DRS(file)

  this.tables = []
  this.isSWGB = null

  if (typeof file === 'undefined') {
    file = {}
  }
  if (typeof file === 'string') {
    if (typeof FsSource !== 'function') {
      throw new Error('Cannot instantiate with a string filename in the browser')
    }
    this.source = new FsSource(file)
  } else if (typeof Blob !== 'undefined' && file instanceof Blob) { // eslint-disable-line no-undef
    this.source = new BlobSource(file)
  } else {
    if (typeof file !== 'object') {
      throw new TypeError('Expected a file path string or an options object, got ' + typeof file)
    }
    this.isSWGB = file.hasOwnProperty('isSWGB') ? file.isSWGB : false
    this.copyright = file.hasOwnProperty('copyright')
      ? file.copyright
      : (this.isSWGB ? COPYRIGHT_SWGB : COPYRIGHT_AOE)
    this.fileVersion = file.hasOwnProperty('fileVersion') ? file.fileVersion : '1.00'
    this.fileType = file.hasOwnProperty('fileType') ? file.fileType : 'tribe\0\0\0\0\0\0\0'
  }
}
function DRS (file) {
  if (!(this instanceof DRS)) return new DRS(file)

  this.tables = []
  this.isSWGB = null

  if (typeof file === 'undefined') {
    file = {}
  }
  if (typeof file === 'string') {
    if (typeof FsSource !== 'function') {
      throw new Error('Cannot instantiate with a string filename in the browser')
    }
    this.source = new FsSource(file)
  } else if (typeof Blob !== 'undefined' && file instanceof Blob) { // eslint-disable-line no-undef
    this.source = new BlobSource(file)
  } else {
    if (typeof file !== 'object') {
      throw new TypeError('Expected a file path string or an options object, got ' + typeof file)
    }
    this.isSWGB = file.hasOwnProperty('isSWGB') ? file.isSWGB : false
    this.copyright = file.hasOwnProperty('copyright')
      ? file.copyright
      : (this.isSWGB ? COPYRIGHT_SWGB : COPYRIGHT_AOE)
    this.fileVersion = file.hasOwnProperty('fileVersion') ? file.fileVersion : '1.00'
    this.fileType = file.hasOwnProperty('fileType') ? file.fileType : 'tribe\0\0\0\0\0\0\0'
  }
}
function DRS ( file ) { if ( ! ( this instanceof DRS ) ) return new DRS ( file ) this . tables = [ ] this . isSWGB = null if ( typeof file === 'undefined' ) { file = { } } if ( typeof file === 'string' ) { if ( typeof FsSource !== 'function' ) { throw new Error ( 'Cannot instantiate with a string filename in the browser' ) } this . source = new FsSource ( file ) } else if ( typeof Blob !== 'undefined' && file instanceof Blob ) { // eslint-disable-line no-undef this . source = new BlobSource ( file ) } else { if ( typeof file !== 'object' ) { throw new TypeError ( 'Expected a file path string or an options object, got ' + typeof file ) } this . isSWGB = file . hasOwnProperty ( 'isSWGB' ) ? file . isSWGB : false this . copyright = file . hasOwnProperty ( 'copyright' ) ? file . copyright : ( this . isSWGB ? COPYRIGHT_SWGB : COPYRIGHT_AOE ) this . fileVersion = file . hasOwnProperty ( 'fileVersion' ) ? file . fileVersion : '1.00' this . fileType = file . hasOwnProperty ( 'fileType' ) ? file . fileType : 'tribe\0\0\0\0\0\0\0' } }
Represents a DRS file.
@constructor
@param {string} file Path to a .DRS file.
Represents a DRS file .