src/preferred-provider.js
function preferredProviderFor (uri) {
  // First, determine if the uri is an OIDC provider
  return providerExists(uri)
    .then(providerUri => {
      if (providerUri) {
        return providerUri // the given uri's origin hosts an OIDC provider
      }

      // Given uri is not a provider (for example, a static Web ID profile URI)
      // Discover its preferred provider
      return discoverProviderFor(uri)
    })
}
function preferredProviderFor (uri) {
  // First, determine if the uri is an OIDC provider
  return providerExists(uri)
    .then(providerUri => {
      if (providerUri) {
        return providerUri // the given uri's origin hosts an OIDC provider
      }

      // Given uri is not a provider (for example, a static Web ID profile URI)
      // Discover its preferred provider
      return discoverProviderFor(uri)
    })
}
function preferredProviderFor ( uri ) { // First, determine if the uri is an OIDC provider return providerExists ( uri ) . then ( providerUri => { if ( providerUri ) { return providerUri // the given uri's origin hosts an OIDC provider } // Given uri is not a provider (for example, a static Web ID profile URI) // Discover its preferred provider return discoverProviderFor ( uri ) } ) }
@param uri {string} Provider URI or Web ID URI

@returns {Promise<string>}
@param uri { string } Provider URI or Web ID URI