/// <reference path="../typings/node/node.d.ts" />

import * as fs from 'fs';

export class Dependument {
  private source: string;
  private output: string;

  constructor(options: any) {
    if (!options.source) {
      throw new Error("No source path specified in options");
    }

    if (!options.output) {
      throw new Error("No output path specified in options");
    }

    this.source = options.source;
    this.output = options.output;
  }

  writeOutput() {
    fs.writeFile(this.output, 'dependument test writeOutput', (err) => {
      if (err) throw err;
      console.log(`Output written to ${this.output}`);
    });
  }
}

/// <reference path="../typings/node/node.d.ts" />

import * as fs from 'fs';

export class Dependument {
  private source: string;
  private output: string;

  constructor(options: any) {
    if (!options) {
      throw new Error("No options provided");
    }

    if (!options.source) {
      throw new Error("No source path specified in options");
    }

    if (!options.output) {
      throw new Error("No output path specified in options");
    }

    this.source = options.source;
    this.output = options.output;
  }

  writeOutput() {
    fs.writeFile(this.output, 'dependument test writeOutput', (err) => {
      if (err) throw err;
      console.log(`Output written to ${this.output}`);
    });
  }
}

Throw error if no options
Throw error if no options
