Skip to content

Commit 0fc4397

Browse files
committed
remove console.log
1 parent 4b5e0ae commit 0fc4397

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/index.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,28 @@ export interface IWebhookObject {
3939
}
4040

4141
export class Webhooks {
42-
private config: IConfig
43-
private db: IStorageProvider
42+
private _config: IConfig
43+
private _db: IStorageProvider
4444
static MemoryStorageProvider = MemoryStorageProvider
4545
static LocalDiskStorageProvider = LocalDiskStorageProvider
4646

4747
constructor (_config?: IConfig) {
48-
this.config = _config || {}
49-
this.db = this.config.storageProvider || new MemoryStorageProvider()
48+
this._config = _config || {}
49+
this._db = this._config.storageProvider || new MemoryStorageProvider()
5050
}
5151

5252
async getAll () {
53-
return this.db.getAll()
53+
return this._db.getAll()
5454
}
5555

5656
async getById (webhookId: string): Promise<IWebhookObject | null> {
57-
const webhook = await this.db.getById(webhookId)
57+
const webhook = await this._db.getById(webhookId)
5858
if (!webhook) return null
5959
return webhook
6060
}
6161

6262
async getByTag (tag: string): Promise<IWebhookObject[] | null> {
63-
const webhooks = await this.db.getByTag(tag)
63+
const webhooks = await this._db.getByTag(tag)
6464
if (!webhooks) return null
6565
return webhooks
6666
}
@@ -69,7 +69,7 @@ export class Webhooks {
6969
if (typeof events === 'string') events = [events]
7070
const webhooks: IWebhookObject[] = []
7171
for (const event of events) {
72-
const results = await this.db.getByEvent(event)
72+
const results = await this._db.getByEvent(event)
7373
if (!results) continue
7474
for (const result of results) {
7575
if (!webhooks.find(e => e.id === result.id)) webhooks.push(result)
@@ -95,17 +95,17 @@ export class Webhooks {
9595
created: createdDate.toJSON(),
9696
modified: createdDate.toJSON()
9797
}
98-
await this.db.add(objectToAdd)
99-
return this.db.getById(id)
98+
await this._db.add(objectToAdd)
99+
return this._db.getById(id)
100100
}
101101

102102
async remove (webhookId: string): Promise<boolean> {
103-
await this.db.remove(webhookId)
103+
await this._db.remove(webhookId)
104104
return true
105105
}
106106

107107
async triggerByEvent (eventType: string, data: any, tagFilter?: string) {
108-
let webhooks = await this.db.getByEvent(eventType)
108+
let webhooks = await this._db.getByEvent(eventType)
109109
if (!webhooks) return null
110110
if (tagFilter) webhooks = webhooks.filter(e => e.tags.includes(tagFilter))
111111
for (const hook of webhooks) {
@@ -145,9 +145,7 @@ export class Webhooks {
145145
}
146146
}
147147
return got.post(url, gotConfig)
148-
} catch (e) {
149-
console.error(e)
150-
}
148+
} catch {}
151149
}
152150
}
153151

0 commit comments

Comments
 (0)