Fix handling of missing opts

This commit is contained in:
Yarmo Mackenbach 2020-10-24 14:36:22 +02:00
parent 1eb98349d2
commit 656ac3541d

View file

@ -44,13 +44,15 @@ const matchSp = (uri) => {
}
const verify = (uri, fingerprint, opts) => {
if (!opts) { opts = {} }
if (!validUrl.isUri(uri)) {
throw new Error('Not a valid URI')
}
const spMatches = matchSp(uri)
if (opts.returnMatchesOnly) {
if ('returnMatchesOnly' in opts && opts.returnMatchesOnly) {
return spMatches
}
}