'use strict';

var _ = require('lodash');
var WebLink = require('./web_link');

var Root = function(url, http, extensions) {
  _.forEach(extensions, function(e) {
    if (!e.initialize) {
      return;
    }

    e.initialize(http, extensions);
  });
  var link = new WebLink({ href: url }, http, extensions);

  this.follow = function(options) {
    return link.follow(options);
  };
};

module.exports = Root;

'use strict';

var _ = require('lodash');
var WebLink = require('./web_link');

var Root = function(url, http, extensions) {
  _.forEach(extensions, function(e) {
    if (!e.initialize) {
      return;
    }

    e.initialize(http, extensions);
  });
  return new WebLink({ href: url }, http, extensions);
};

module.exports = Root;

Return WebLink directly from Root constructor.
Return WebLink directly from Root constructor.

* Same follow symantics on object returned from Root
  constructor, but also gives freedom to set root.type = 'blah'
  to modify WebLink settings before following.
