Change code structure

This commit is contained in:
Yarmo Mackenbach 2020-10-24 20:33:34 +02:00
parent 568f62a7cd
commit 33a2a7804a

View file

@ -13,25 +13,25 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.list = [
const list = [
'dns',
'xmpp',
'twitter',
'hackernews',
]
exports.data = {
const data = {
dns: require('./serviceproviders/dns'),
xmpp: require('./serviceproviders/xmpp'),
twitter: require('./serviceproviders/twitter'),
hackernews: require('./serviceproviders/hackernews'),
}
exports.match = (uri) => {
const match = (uri) => {
let matches = [], sp
serviceprovidersList.forEach((spName, i) => {
sp = serviceproviders[spName]
list.forEach((spName, i) => {
sp = data[spName]
if (sp.reURI.test(uri)) {
matches.push(sp.processURI(uri))
}
@ -39,3 +39,7 @@ exports.match = (uri) => {
return matches
}
exports.list = list
exports.data = data
exports.match = match