lib/disguise.js
function disguise(target, source, unthenable) {
  if (source == null || target === source) return target

  for (var key in source) {
    if (target[key] !== undefined) continue
    if (unthenable && (key === 'then' || key === 'catch')) continue

    if (typeof source[key] === 'function')
      var descriptor = {
        value: source[key]
      }
    else
      var descriptor = {
        get: function () {
          return source[key]
        },
        set: function (value) {
          source[key] = value
        }
      }

    descriptor.enumerable = true

    Object.defineProperty(target, key, descriptor)
  }
  return target
}
function disguise(target, source, unthenable) {
  if (source == null || target === source) return target

  for (var key in source) {
    if (target[key] !== undefined) continue
    if (unthenable && (key === 'then' || key === 'catch')) continue

    if (typeof source[key] === 'function')
      var descriptor = {
        value: source[key]
      }
    else
      var descriptor = {
        get: function () {
          return source[key]
        },
        set: function (value) {
          source[key] = value
        }
      }

    descriptor.enumerable = true

    Object.defineProperty(target, key, descriptor)
  }
  return target
}
function disguise ( target , source , unthenable ) { if ( source == null || target === source ) return target for ( var key in source ) { if ( target [ key ] !== undefined ) continue if ( unthenable && ( key === 'then' || key === 'catch' ) ) continue if ( typeof source [ key ] === 'function' ) var descriptor = { value : source [ key ] } else var descriptor = { get : function ( ) { return source [ key ] } , set : function ( value ) { source [ key ] = value } } descriptor . enumerable = true Object . defineProperty ( target , key , descriptor ) } return target }
Public API  
Disguise an object giving it the appearance of another

Add bind'ed functions and properties to a `target` object delegating the
actions and attributes updates to the `source` one while retaining its
original personality (i.e. duplicates and `instanceof` are preserved)

@param {Object} target - the object to be disguised
@param {Object} source - the object where to fetch its methods and attributes
@param {Object} [unthenable] - the returned object should not be a thenable

@return {Object} `target` disguised
Public API Disguise an object giving it the appearance of another