diff --git a/index.d.ts b/index.d.ts
index 0be859e..a8f0e70 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -9,7 +9,7 @@
///
-import { EventEmitter } from 'events';
+import { EventEmitter } from "events";
export default Nedb;
@@ -18,17 +18,17 @@ declare class Nedb extends EventEmitter {
persistence: Nedb.Persistence;
- autoloadPromise: Promise|null;
+ autoloadPromise: Promise | null;
loadDatabase(callback?: (err: Error | null) => void): void;
loadDatabaseAsync(): Promise;
- dropDatabase(callback?: (err: Error |null) => void): void;
+ dropDatabase(callback?: (err: Error | null) => void): void;
dropDatabaseAsync(): Promise;
- compactDatafile(callback?: (err: Error |null) => void): void;
+ compactDatafile(callback?: (err: Error | null) => void): void;
compactDatafileAsync(): Promise;
@@ -38,7 +38,10 @@ declare class Nedb extends EventEmitter {
getAllData(): T[];
- ensureIndex(options: Nedb.EnsureIndexOptions, callback?: (err: Error | null) => void): void;
+ ensureIndex(
+ options: Nedb.EnsureIndexOptions,
+ callback?: (err: Error | null) => void
+ ): void;
ensureIndexAsync(options: Nedb.EnsureIndexOptions): Promise;
@@ -46,8 +49,14 @@ declare class Nedb extends EventEmitter {
removeIndexAsync(fieldName: string | string[]): Promise;
- insert(newDoc: T, callback?: (err: Error | null, document: T) => void): void;
- insert(newDocs: T[], callback?: (err: Error | null, documents: T[]) => void): void;
+ insert(
+ newDoc: T,
+ callback?: (err: Error | null, document: T) => void
+ ): void;
+ insert(
+ newDocs: T[],
+ callback?: (err: Error | null, documents: T[]) => void
+ ): void;
insertAsync(newDoc: T): Promise;
insertAsync(newDocs: T[]): Promise;
@@ -57,36 +66,72 @@ declare class Nedb extends EventEmitter {
countAsync(query: any): Nedb.Cursor;
- find(query: any, projection: any, callback?: (err: Error | null, documents: T[]) => void): void;
+ find(
+ query: any,
+ projection: any,
+ callback?: (err: Error | null, documents: T[]) => void
+ ): void;
find(query: any, projection?: any): Nedb.Cursor;
- find(query: any, callback: (err: Error | null, documents: T[]) => void): void;
+ find(
+ query: any,
+ callback: (err: Error | null, documents: T[]) => void
+ ): void;
findAsync(query: any, projection?: any): Nedb.Cursor;
- findOne(query: any, projection: any, callback: (err: Error | null, document: T) => void): void;
- findOne(query: any, callback: (err: Error | null, document: T) => void): void;
+ findOne(
+ query: any,
+ projection: any,
+ callback: (err: Error | null, document: T) => void
+ ): void;
+ findOne(
+ query: any,
+ callback: (err: Error | null, document: T) => void
+ ): void;
findOneAsync(query: any, projection?: any): Nedb.Cursor;
- update(query: any, updateQuery: any, options?: Nedb.UpdateOptions, callback?: (err: Error | null, numberOfUpdated: number, affectedDocuments: T | T[] | null, upsert: boolean | null) => void): void;
-
- updateAsync(query: any, updateQuery: any, options?: Nedb.UpdateOptions): Promise<{numAffected: number, affectedDocuments: T|T[]|null, upsert: boolean}>;
-
- remove(query: any, options: Nedb.RemoveOptions, callback?: (err: Error | null, n: number) => void): void;
+ update(
+ query: any,
+ updateQuery: any,
+ options?: Nedb.UpdateOptions,
+ callback?: (
+ err: Error | null,
+ numberOfUpdated: number,
+ affectedDocuments: T | T[] | null,
+ upsert: boolean | null
+ ) => void
+ ): void;
+
+ updateAsync(
+ query: any,
+ updateQuery: any,
+ options?: Nedb.UpdateOptions
+ ): Promise<{
+ numAffected: number;
+ affectedDocuments: T | T[] | null;
+ upsert: boolean;
+ }>;
+
+ remove(
+ query: any,
+ options: Nedb.RemoveOptions,
+ callback?: (err: Error | null, n: number) => void
+ ): void;
remove(query: any, callback?: (err: Error | null, n: number) => void): void;
removeAsync(query: any, options: Nedb.RemoveOptions): Promise;
- addListener(event: 'compaction.done', listener: () => void): this;
- on(event: 'compaction.done', listener: () => void): this;
- once(event: 'compaction.done', listener: () => void): this;
- prependListener(event: 'compaction.done', listener: () => void): this;
- prependOnceListener(event: 'compaction.done', listener: () => void): this;
- removeListener(event: 'compaction.done', listener: () => void): this;
- off(event: 'compaction.done', listener: () => void): this;
- listeners(event: 'compaction.done'): Array<() => void>;
- rawListeners(event: 'compaction.done'): Array<() => void>;
- listenerCount(type: 'compaction.done'): number;
+ addListener(event: "compaction.done", listener: () => void): this;
+ on(event: "compaction.done", listener: () => void): this;
+ once(event: "compaction.done", listener: () => void): this;
+ prependListener(event: "compaction.done", listener: () => void): this;
+ prependOnceListener(event: "compaction.done", listener: () => void): this;
+ removeListener(event: "compaction.done", listener: () => void): this;
+ off(event: "compaction.done", listener: () => void): this;
+ listeners(event: "compaction.done"): Array<() => void>;
+ rawListeners(event: "compaction.done"): Array<() => void>;
+ listenerCount(type: "compaction.done"): number;
}
declare namespace Nedb {
@@ -113,7 +158,7 @@ declare namespace Nedb {
afterSerialization?(line: string): string;
corruptAlertThreshold?: number;
compareStrings?(a: string, b: string): number;
- modes?: {fileMode: number, dirMode: number};
+ modes?: { fileMode: number; dirMode: number };
testSerializationHooks?: boolean;
}