docs: function (obj, resolve, reject) {
          // if promise like
          if (obj && typeof obj.then === 'function') {
              return Promise.resolve(obj).then(resolve).catch(reject);
          }
          // if observable
          if (obj && typeof obj.subscribe === 'function') {
              var obs_1 = obj;
              return new SafeSubscription(function (sub) { return obs_1.subscribe({
                  next: function () {
                      if (sub.subscribed) {
                          sub.unsubscribe();
                          resolve(obj);
                      }
                  },
                  error: function (error) {
                      if (sub.subscribed) {
                          sub.unsubscribe();
                          reject(error);
                      }
                  },
                  complete: function () {
                      if (sub.subscribed) {
                          sub.unsubscribe();
                          resolve(obj);
                      }
                  }
              }); });
          }
          // else just resolve
          try {
              return resolve(obj);
          }
          catch (error) {
              return reject(error);
          }
      }