Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) {
throw new UnimplementedMethodError(`Unimplemented method "${method}"`)
}
if (isFunction(provider._checkMethodVersionSupport)) {
if (!provider._checkMethodVersionSupport(method, this.version)) {
throw new UnsupportedMethodError(`Method "${method}" is not supported by version "${this.version}"`)
}
}
return provider
}