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 {Cache, Collection, Awaitable} from "../../util"
import {Cache, Collection, Awaitable} from '../../util'
/**
* An in-memory implementation of the Cache.
@@ -23,17 +23,19 @@ export class MemoryCache extends Cache {
existing.value = value
existing.expires = expires
} else {
MemoryCache.cacheItems.push({ key, value, expires })
MemoryCache.cacheItems.push({ key,
value,
expires })
}
}
public has(key: string): Awaitable<boolean> {
const now = new Date()
return !!MemoryCache.cacheItems
return Boolean(MemoryCache.cacheItems
.where('key', '=', key)
.firstWhere(item => {
return !item.expires || now < item.expires
})
}))
}
public drop(key: string): Awaitable<void> {