reorder functions for no-use-before-define
This commit is contained in:
34
src/mail.js
34
src/mail.js
@@ -30,8 +30,6 @@ const OWNERTYPE_APP = 'app';
|
||||
const TYPE_MAILBOX = 'mailbox';
|
||||
const TYPE_LIST = 'list';
|
||||
const TYPE_ALIAS = 'alias';
|
||||
const _delByDomain = delByDomain;
|
||||
const _updateDomain = updateDomain;
|
||||
|
||||
|
||||
const DNS_OPTIONS = { timeout: 20000, tries: 4 };
|
||||
@@ -831,20 +829,6 @@ async function listMailboxes(page, perPage) {
|
||||
return results;
|
||||
}
|
||||
|
||||
async function getStats(domain) {
|
||||
assert.strictEqual(typeof domain, 'string');
|
||||
|
||||
const mailboxes = await listMailboxesByDomain(domain, 1, 10000);
|
||||
const mailingLists = await listMailingListsByDomain(domain, 1, 10000);
|
||||
|
||||
return {
|
||||
mailboxCount: mailboxes.length,
|
||||
pop3Count: mailboxes.filter(mb => mb.enablePop3).length,
|
||||
aliasCount: mailboxes.map(mb => mb.aliases.length).reduce((a, b) => a + b, 0),
|
||||
mailingListCount: mailingLists.length
|
||||
};
|
||||
}
|
||||
|
||||
async function delByDomain(domain) {
|
||||
assert.strictEqual(typeof domain, 'string');
|
||||
|
||||
@@ -1061,6 +1045,20 @@ async function listMailingListsByDomain(domain, page, perPage) {
|
||||
return results;
|
||||
}
|
||||
|
||||
async function getStats(domain) {
|
||||
assert.strictEqual(typeof domain, 'string');
|
||||
|
||||
const mailboxes = await listMailboxesByDomain(domain, 1, 10000);
|
||||
const mailingLists = await listMailingListsByDomain(domain, 1, 10000);
|
||||
|
||||
return {
|
||||
mailboxCount: mailboxes.length,
|
||||
pop3Count: mailboxes.filter(mb => mb.enablePop3).length,
|
||||
aliasCount: mailboxes.map(mb => mb.aliases.length).reduce((a, b) => a + b, 0),
|
||||
mailingListCount: mailingLists.length
|
||||
};
|
||||
}
|
||||
|
||||
async function getMailingList(name, domain) {
|
||||
assert.strictEqual(typeof name, 'string');
|
||||
assert.strictEqual(typeof domain, 'string');
|
||||
@@ -1195,6 +1193,8 @@ async function checkStatus() {
|
||||
}
|
||||
}
|
||||
|
||||
const _delByDomain = delByDomain;
|
||||
|
||||
export default {
|
||||
getStatus,
|
||||
checkConfiguration,
|
||||
@@ -1237,5 +1237,5 @@ export default {
|
||||
TYPE_LIST,
|
||||
TYPE_ALIAS,
|
||||
_delByDomain,
|
||||
_updateDomain,
|
||||
_updateDomain: updateDomain,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user