code: function objectFactory(data) {
      // if we are given an object Object, no-op and return it now.
      if (_.isPlainObject(data)) {
          return data;
      }
  
      // If we are given a byte Buffer, parse it as utf-8
      if (data instanceof Buffer) {
          data = data.toString('utf-8');
      }
  
      // If we now have a string, then assume it is a JSON string.
      if (_.isString(data)) {
          data = JSON.parse(data);
      }
  
      else {
          throw new Error(
              'Could not convert data into an object.  ' +
              'Data must be a utf-8 byte buffer or a JSON string'
          );
      }
  
      return data;
  }
docs: Converts a utf-8 byte buffer or a JSON string into
  an object and returns it.