Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-06-02 22:36:25 -05:00
parent 82e7a1f299
commit 1d5056b753
149 changed files with 6104 additions and 3114 deletions

View File

@@ -1,4 +1,4 @@
import {Awaitable} from "../support/types"
import {Awaitable} from '../support/types'
/**
* Abstract interface class for a cached object.

View File

@@ -20,22 +20,28 @@ export class InMemCache extends Cache {
*/
protected items: Collection<InMemCacheItem> = new Collection<InMemCacheItem>()
public async fetch(key: string) {
public async fetch(key: string): Promise<string | undefined> {
const item = this.items.firstWhere('key', '=', key)
if ( item ) return item.item
if ( item ) {
return item.item
}
}
public async put(key: string, item: string) {
public async put(key: string, item: string): Promise<void> {
const existing = this.items.firstWhere('key', '=', key)
if ( existing ) existing.item = item
else this.items.push({ key, item })
if ( existing ) {
existing.item = item
} else {
this.items.push({ key,
item })
}
}
public async has(key: string) {
public async has(key: string): Promise<boolean> {
return this.items.where('key', '=', key).length > 0
}
public async drop(key: string) {
public async drop(key: string): Promise<void> {
this.items = this.items.whereNot('key', '=', key)
}
}