index.js
function Robot(opts) {

  if (!(this instanceof Robot)) {
    return new Robot(opts);
  }

  this.chains = opts.chains;

  this.offset = opts.offset || [0, 0, 0];

  if (!opts.orientation) {
    opts.orientation = {};
  }

  this.orientation = {
    pitch: opts.orientation.pitch || 0,
    yaw: opts.orientation.yaw || 0,
    roll: opts.orientation.roll || 0
  };

}
function Robot(opts) {

  if (!(this instanceof Robot)) {
    return new Robot(opts);
  }

  this.chains = opts.chains;

  this.offset = opts.offset || [0, 0, 0];

  if (!opts.orientation) {
    opts.orientation = {};
  }

  this.orientation = {
    pitch: opts.orientation.pitch || 0,
    yaw: opts.orientation.yaw || 0,
    roll: opts.orientation.roll || 0
  };

}
function Robot ( opts ) { if ( ! ( this instanceof Robot ) ) { return new Robot ( opts ) ; } this . chains = opts . chains ; this . offset = opts . offset || [ 0 , 0 , 0 ] ; if ( ! opts . orientation ) { opts . orientation = { } ; } this . orientation = { pitch : opts . orientation . pitch || 0 , yaw : opts . orientation . yaw || 0 , roll : opts . orientation . roll || 0 } ; }
Wrap our chains into a single object we can control  @param {Object} opts Options: {chains, offset, orientation} - opts.chains {Array} An array of chains that makeup this robot - opts.robotType {String} One of the predefined robot types. - opts.offset {Array} A three element array describing an offset for the robot's origin point. This can be used to shift the robot's position relative to its origin point (picture the robot shifting it's weight along the x/z plane or stretching to be taller without moving the end effectors) - opts.orientation {Array} A three element array of Numbers giving the rotation of the robot's chassis around its origin point (make it dance! )
Wrap our chains into a single object we can control