dist/FrontRouter.js
function FrontRouter() {
    var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

    _classCallCheck(this, FrontRouter);

    this.options = {
      pageRoot: opts.pageRoot || process.cwd(),
      overwrite: opts.overwrite || false
    };
    this.routes = [];

    // Figure out what library to load
    switch (_typeof(opts.library)) {
      // String: pull a library out of the built-in ones
      case 'string':
        {
          var lib = Libraries[opts.library];
          if (typeof lib === 'undefined') {
            throw new Error('Front Router: there\'s no built-in plugin for "' + opts.library + '"');
          } else {
            this.options.library = lib;
          }
          break;
        }
      // Function: add as-is
      case 'function':
        {
          this.options.library = opts.library;
          break;
        }
      // Nothing: use the default library adapter
      case 'undefined':
        {
          this.options.library = Libraries.default;
          break;
        }
      // Other weird values? Nope
      default:
        {
          throw new Error('Front Router: library must be a string or function.');
        }
    }
  }
function FrontRouter() {
    var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

    _classCallCheck(this, FrontRouter);

    this.options = {
      pageRoot: opts.pageRoot || process.cwd(),
      overwrite: opts.overwrite || false
    };
    this.routes = [];

    // Figure out what library to load
    switch (_typeof(opts.library)) {
      // String: pull a library out of the built-in ones
      case 'string':
        {
          var lib = Libraries[opts.library];
          if (typeof lib === 'undefined') {
            throw new Error('Front Router: there\'s no built-in plugin for "' + opts.library + '"');
          } else {
            this.options.library = lib;
          }
          break;
        }
      // Function: add as-is
      case 'function':
        {
          this.options.library = opts.library;
          break;
        }
      // Nothing: use the default library adapter
      case 'undefined':
        {
          this.options.library = Libraries.default;
          break;
        }
      // Other weird values? Nope
      default:
        {
          throw new Error('Front Router: library must be a string or function.');
        }
    }
  }
function FrontRouter ( ) { var opts = arguments . length <= 0 || arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ; _classCallCheck ( this , FrontRouter ) ; this . options = { pageRoot : opts . pageRoot || process . cwd ( ) , overwrite : opts . overwrite || false } ; this . routes = [ ] ; // Figure out what library to load switch ( _typeof ( opts . library ) ) { // String: pull a library out of the built-in ones case 'string' : { var lib = Libraries [ opts . library ] ; if ( typeof lib === 'undefined' ) { throw new Error ( 'Front Router: there\'s no built-in plugin for "' + opts . library + '"' ) ; } else { this . options . library = lib ; } break ; } // Function: add as-is case 'function' : { this . options . library = opts . library ; break ; } // Nothing: use the default library adapter case 'undefined' : { this . options . library = Libraries . default ; break ; } // Other weird values? Nope default : { throw new Error ( 'Front Router: library must be a string or function.' ) ; } } }
Creates a new instance of `FrontRouter`.
@prop {FrontRouterOptions} opts - Class options.
Creates a new instance of FrontRouter .