From 2b22799fff079e0c4c156de870deaf57321376ec Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Sun, 25 Oct 2020 01:02:08 +0200 Subject: [PATCH] Allow opts to pass through to matching function --- src/index.js | 4 ++-- src/serviceproviders.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 16b4976..200c889 100644 --- a/src/index.js +++ b/src/index.js @@ -21,14 +21,14 @@ const claimVerification = require('./claimVerification') const utils = require('./utils') const verify = async (uri, fingerprint, opts) => { - if (!opts) { opts = {} } if (!fingerprint) { fingerprint = null } + if (!opts) { opts = {} } if (!validUrl.isUri(uri)) { throw new Error('Not a valid URI') } - const spMatches = serviceproviders.match(uri, fingerprint) + const spMatches = serviceproviders.match(uri, opts) if ('returnMatchesOnly' in opts && opts.returnMatchesOnly) { return spMatches diff --git a/src/serviceproviders.js b/src/serviceproviders.js index 7d53436..18e1951 100644 --- a/src/serviceproviders.js +++ b/src/serviceproviders.js @@ -27,13 +27,13 @@ const data = { hackernews: require('./serviceproviders/hackernews'), } -const match = (uri) => { +const match = (uri, opts) => { let matches = [], sp list.forEach((spName, i) => { sp = data[spName] if (sp.reURI.test(uri)) { - matches.push(sp.processURI(uri)) + matches.push(sp.processURI(uri, opts)) } })