lib/proto.js
function register(root) {
  var leaf = this; // jscs:ignore safeContextKeyword
  // TODO: default base path?
  var dir = path.resolve(root);
  // Try as a directory if no name given.
  if (arguments.length <= 1) {
    registerDir(this, dir);
    return this;
  }
  // The names are not only path to the files but also path to the attributes.
  for (var i = 1, len = arguments.length - 1; i < len; i++) {
    var sub = arguments[i];
    leaf = subRegister(leaf, sub);
    dir = path.resolve(dir, sub);
  }
  // Only the last name is registered (others are used as the path; see above).
  var name = arguments[i++];
  dir = path.resolve(dir, name);
  // Handle with require if possible.
  if (registerMod(leaf, dir, name)) {
    return this;
  }
  // Handle as a directory if possible.
  registerDir(leaf, dir, name);
  return this;
}
function register(root) {
  var leaf = this; // jscs:ignore safeContextKeyword
  // TODO: default base path?
  var dir = path.resolve(root);
  // Try as a directory if no name given.
  if (arguments.length <= 1) {
    registerDir(this, dir);
    return this;
  }
  // The names are not only path to the files but also path to the attributes.
  for (var i = 1, len = arguments.length - 1; i < len; i++) {
    var sub = arguments[i];
    leaf = subRegister(leaf, sub);
    dir = path.resolve(dir, sub);
  }
  // Only the last name is registered (others are used as the path; see above).
  var name = arguments[i++];
  dir = path.resolve(dir, name);
  // Handle with require if possible.
  if (registerMod(leaf, dir, name)) {
    return this;
  }
  // Handle as a directory if possible.
  registerDir(leaf, dir, name);
  return this;
}
Register.

Map file structure to an object.

@param {String} root the path to the file or directory
@param {String} ...names the names are not only path to the files but also path
to the attributes

@return {this}