nedb-async
Advanced tools
Comparing version 0.0.6 to 0.0.7
import * as Nedb from "nedb"; | ||
export default class AsyncNedb extends Nedb { | ||
constructor(pathOrOptions?: string | Nedb.DataStoreOptions | undefined); | ||
asyncFind<T>(query: any, projection?: T): Promise<{}>; | ||
asyncCount(): Promise<{}>; | ||
asyncFindOne<T>(query: any, projection?: T): Promise<{}>; | ||
asyncFind<T>(query: any, projection?: T): Promise<T[]>; | ||
asyncCount(): Promise<{} | {}[]>; | ||
asyncFindOne<T>(query: any, projection?: T): Promise<T>; | ||
asyncInsert(): Promise<{}>; | ||
@@ -8,0 +8,0 @@ asyncUpdate(query: any, updateQuery: any, options?: Nedb.UpdateOptions): Promise<{}>; |
@@ -1,2 +0,2 @@ | ||
export declare const promisefy: (name: string, _arg: IArguments) => Promise<{}>; | ||
export declare function promisefy<T>(name: string, _arg: IArguments): Promise<T[] | T>; | ||
export declare function justPromise(name: string, arg: IArguments): Promise<{}>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.promisefy = function (name, _arg) { | ||
function promisefy(name, _arg) { | ||
return new Promise((rs, rj) => { | ||
@@ -65,3 +65,4 @@ /** | ||
}); | ||
}; | ||
} | ||
exports.promisefy = promisefy; | ||
function justPromise(name, arg) { | ||
@@ -68,0 +69,0 @@ return new Promise((rs, rj) => { |
@@ -9,3 +9,3 @@ import * as Nedb from "nedb"; | ||
public asyncFind<T>(query: any, projection?: T) { | ||
return promisefy.call(this, 'find', arguments) | ||
return promisefy.call(this, 'find', arguments) as Promise<T[]> | ||
} | ||
@@ -16,3 +16,3 @@ asyncCount() { | ||
asyncFindOne<T>(query: any, projection?: T) { | ||
return promisefy.call(this, 'findOne', arguments) | ||
return promisefy.call(this, 'findOne', arguments) as Promise<T> | ||
} | ||
@@ -26,3 +26,3 @@ asyncInsert() { | ||
asyncRemove() { | ||
return justPromise.call(this, 'remove', arguments) | ||
return justPromise.call(this, 'remove', arguments) | ||
} | ||
@@ -29,0 +29,0 @@ asyncEnsureIndex() { |
{ | ||
"name": "nedb-async", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Promise wrapper for Nedb that makes it possible to use all Nedb all cursor modifiers.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,2 +0,2 @@ | ||
export const promisefy = function (name: string, _arg:IArguments) { | ||
export function promisefy<T>(name: string, _arg:IArguments):Promise<T[]|T> { | ||
return new Promise((rs, rj) => { | ||
@@ -3,0 +3,0 @@ /** |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14102
248
0