mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-23 06:59:29 -07:00
Change code structure
This commit is contained in:
parent
568f62a7cd
commit
33a2a7804a
1 changed files with 9 additions and 5 deletions
|
@ -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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
exports.list = [
|
const list = [
|
||||||
'dns',
|
'dns',
|
||||||
'xmpp',
|
'xmpp',
|
||||||
'twitter',
|
'twitter',
|
||||||
'hackernews',
|
'hackernews',
|
||||||
]
|
]
|
||||||
|
|
||||||
exports.data = {
|
const data = {
|
||||||
dns: require('./serviceproviders/dns'),
|
dns: require('./serviceproviders/dns'),
|
||||||
xmpp: require('./serviceproviders/xmpp'),
|
xmpp: require('./serviceproviders/xmpp'),
|
||||||
twitter: require('./serviceproviders/twitter'),
|
twitter: require('./serviceproviders/twitter'),
|
||||||
hackernews: require('./serviceproviders/hackernews'),
|
hackernews: require('./serviceproviders/hackernews'),
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.match = (uri) => {
|
const match = (uri) => {
|
||||||
let matches = [], sp
|
let matches = [], sp
|
||||||
|
|
||||||
serviceprovidersList.forEach((spName, i) => {
|
list.forEach((spName, i) => {
|
||||||
sp = serviceproviders[spName]
|
sp = data[spName]
|
||||||
if (sp.reURI.test(uri)) {
|
if (sp.reURI.test(uri)) {
|
||||||
matches.push(sp.processURI(uri))
|
matches.push(sp.processURI(uri))
|
||||||
}
|
}
|
||||||
|
@ -39,3 +39,7 @@ exports.match = (uri) => {
|
||||||
|
|
||||||
return matches
|
return matches
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.list = list
|
||||||
|
exports.data = data
|
||||||
|
exports.match = match
|
||||||
|
|
Loading…
Reference in a new issue