mirror of
https://github.com/nullnyat/NullcatChan.git
synced 2025-08-06 01:03:52 +09:00
Refactor
This commit is contained in:
13
src/utils/get-collection.ts
Normal file
13
src/utils/get-collection.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import * as loki from 'lokijs';
|
||||
|
||||
export default function(db: loki, name: string, opts?: any): loki.Collection {
|
||||
let collection;
|
||||
|
||||
collection = db.getCollection(name);
|
||||
|
||||
if (collection === null) {
|
||||
collection = db.addCollection(name, opts);
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
Reference in New Issue
Block a user