mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue