code: function instanceOf(value, Type) {
    var isConstructorNameSame;
    var isConstructorSourceSame;
  
    // If `instanceof` returned `true` we know result right away.
    var isInstanceOf = value instanceof Type;
  
    // If `instanceof` returned `false` we do ducktype check since `Type` may be
    // from a different sandbox. If a constructor of the `value` or a constructor
    // of the value"s prototype has same name and source we assume that it"s an
    // instance of the Type.
    if (!isInstanceOf && value) {
      isConstructorNameSame = value.constructor.name === Type.name;
      isConstructorSourceSame = String(value.constructor) == String(Type);
      isInstanceOf = (isConstructorNameSame && isConstructorSourceSame) ||
                      instanceOf(Object.getPrototypeOf(value), Type);
    }
    return isInstanceOf;
  }
docs: Returns if `value` is an instance of a given `Type`. This is exactly same as
  `value instanceof Type` with a difference that `Type` can be from a scope
  that has a different top level object. (Like in case where `Type` is a
  function from different iframe / jetpack module / sandbox).