Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getProviderForMethod (method, requestor = false) {
if (this._providers.length === 0) {
throw new NoProviderError('No provider provided. Add a provider to the client')
}
let indexOfRequestor = requestor
? findLastIndex(
this._providers,
provider => requestor.constructor === provider.constructor
) : this._providers.length
if (indexOfRequestor === -1) indexOfRequestor = 0
const provider = findLast(
this._providers,
provider => isFunction(provider[method]), indexOfRequestor - 1
)
if (provider == null) {