Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nedb-promises

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nedb-promises - npm Package Compare versions

Comparing version 5.0.3 to 6.0.0-pre

31

CHANGELOG.md

@@ -7,8 +7,21 @@ # Changelog

## 4.1.4
## 5.0.1 - 5.0.3
### Fixed
- `underscore` security vulnerability
- Vulnerable dependencies.
### Updated
- Code style.
- Some documentation issues.
## 5.0.0
### Updated
- Switched from `nedb` to `@seald-io/nedb`, to solve vulnerability issues.
## 4.1.4 - 4.1.6
### Fixed
- Vulnerable dependencies.
## 4.1.1 - 4.1.3
- typescript definition file updates
### Updated
- TypeScript definition file.

@@ -21,12 +34,12 @@ ## 4.1.0

### Updated
- vulnerable dependencies
- tabs to spaces in code
- typescript doc file
- Vulnerable dependencies.
- Tabs to spaces in code.
- TypeScript definition file.
## 4.0.1
### Changed
- Updated dependencies
### Updated
- Vulnerable dependencies.
## 4.0.0
### Changed
### Updated
- The [findOne](https://github.com/bajankristof/nedb-promises/blob/master/docs.md#Datastore+findOne) and [count](https://github.com/bajankristof/nedb-promises/blob/master/docs.md#Datastore+count) `Datastore` methods now return a `Cursor` object instead of a `Promise`, allowing users to e.g.: find the most recently updated document, etc.

@@ -19,2 +19,3 @@ ## Classes

* [.limit()](#Cursor+limit) ⇒ [<code>Cursor</code>](#Cursor)
* [.project()](#Cursor+project) ⇒ [<code>Cursor</code>](#Cursor)
* [.exec()](#Cursor+exec) ⇒ <code>Promise.&lt;Array.&lt;Object&gt;&gt;</code>

@@ -48,2 +49,10 @@ * [.then(fulfilled, [rejected])](#Cursor+then) ⇒ <code>Promise</code>

**Kind**: instance method of [<code>Cursor</code>](#Cursor)
<a name="Cursor+project"></a>
### cursor.project() ⇒ [<code>Cursor</code>](#Cursor)
Set the document projection.
See: https://github.com/louischatriot/nedb#projections
**Kind**: instance method of [<code>Cursor</code>](#Cursor)
<a name="Cursor+exec"></a>

@@ -54,7 +63,2 @@

You can use the same cursor methods
that you could with the original module:
https://github.com/louischatriot/nedb#sorting-and-paginating
Since the Cursor has a `then` and a `catch` method

@@ -61,0 +65,0 @@ JavaScript identifies it as a thenable object

@@ -1,261 +0,474 @@

import { EventEmitter } from 'events'
import { EventEmitter } from 'events';
// Type definitions for NeDB 1.8
// Project: https://github.com/bajankristof/nedb-promises
// Definitions by: Sam Denty <https://github.com/samdenty99>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = Datastore
export as namespace Datastore
declare namespace NeDB {
type Query = {
[key: string]: any;
}
type Document = {
_id: string
createdAt?: Date
updatedAt?: Date
}
type Update = {
[key: string]: any;
}
/**
* @summary
* As of v2.0.0 the Datastore class extends node's built
* in EventEmitter class and implements each method as an event
* plus additional error events.
*
* All event callbacks will be passed the same type of values,
* the first being the datastore, then the operation result (if there is any)
* and then the arguments of the called method. (Check out the first example!)
*
* All events have a matching error event that goes by the name of `${method}Error`,
* for example `findError` or `loadError`. The callbacks of these events will receive
* the same parameters as the normal event handlers except that instead of the
* operation result there will be an operation error. (Check out the second example!)
*
* A generic `error` event is also available. This event will be emitted at any of
* the above error events. The callbacks of this event will receive the same parameters
* as the specific error event handlers except that there will be one more parameter
* passed between the datastore and the error object, that being the name of the method
* that failed. (Check out the third example!)
*
* @example
* let datastore = Datastore.create()
* datastore.on('update', (datastore, result, query, update, options) => {
* })
* datastore.on('load', (datastore) => {
* // this event doesn't have a result
* })
* datastore.on('ensureIndex', (datastore, options) => {
* // this event doesn't have a result
* // but it has the options argument which will be passed to the
* // event handlers
* })
*
* @example
* let datastore = Datastore.create()
* datastore.on('updateError', (datastore, error, query, update, options) => {
* })
* datastore.on('loadError', (datastore, error) => {
* })
* datastore.on('ensureIndexError', (datastore, error, options) => {
* })
*
* @example
* let datastore = Datastore.create()
* datastore.on('error', (datastore, event, error, ...args) => {
* // for example
* // datastore, 'find', error, [{ foo: 'bar' }, {}]
* })
*
* @class
*/
declare class Datastore extends EventEmitter {
type Projection<TSchema> = {
[p in keyof TSchema]?: number;
}
persistence: Nedb.Persistence
interface Persistence {
/**
* Under the hood, NeDB's persistence uses an append-only format, meaning
* that all updates and deletes actually result in lines added at the end
* of the datafile, for performance reasons. The database is automatically
* compacted (i.e. put back in the one-line-per-document format) every
* time you load each database within your application.
*
* You can manually call the compaction function with
* `datastore.persistence.compactDatafile` which takes no argument. It
* queues a compaction of the datafile in the executor, to be executed
* sequentially after all pending operations. The datastore will fire a
* compaction.done event once compaction is finished.
*/
compactDatafile(): void;
/**
* Datastore constructor...
*
* You should use `Datastore.create(...)` instead
* of `new Datastore(...)`. With that you can access
* the original datastore's properties such as `datastore.persistence`.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#creatingloading-a-database
*/
constructor(pathOrOptions?: string | Nedb.DatastoreOptions)
/**
* Set automatic compaction at a regular `interval` in milliseconds (a
* minimum of 5s is enforced).
*/
setAutocompactionInterval(interval: number): void;
/**
* Load the datastore.
*/
load(): Promise<undefined>
/**
* Stop automatic compaction with
* `datastore.persistence.stopAutocompaction()`.
*/
stopAutocompaction(): void;
}
/**
* Find documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#finding-documents
*
* There are differences minor in how the cursor works though.
*
* @example
* datastore.find({ ... }).sort({ ... }).exec().then(...)
*
* @example
* datastore.find({ ... }).sort({ ... }).then(...)
*
* @example
* // in an async function
* await datastore.find({ ... }).sort({ ... })
*/
find<T>(query: any, projection?: {[p in keyof T | '_id' | 'createdAt' | 'updatedAt']?:number}): Nedb.Cursor<T & Document>
interface AbstractCursor<TSchema> {
/**
* Sort the queried documents.
*
* See: https://github.com/louischatriot/nedb#sorting-and-paginating
*/
sort(query: any): this;
/**
* Find a document that matches a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#finding-documents
*/
findOne<T>(query: any, projection?: {[p in keyof T | '_id' | 'createdAt' | 'updatedAt']?:number}): Promise<T & Document>
/**
* Skip some of the queried documents.
*
* See: https://github.com/louischatriot/nedb#sorting-and-paginating
*/
skip(n: number): this;
/**
* Insert a document or documents.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#inserting-documents
*
* @param {Object|Object[]} docs
* @return {Promise.<Object|Object[]>}
*/
insert<T extends any | any[]>(docs: T): Promise<T & Document>
/**
* Limit the queried documents.
*
* See: https://github.com/louischatriot/nedb#sorting-and-paginating
*/
limit(n: number): this;
/**
* Update documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#updating-documents
*
* If you set `options.returnUpdatedDocs`,
* the returned promise will resolve with
* an object (if `options.multi` is `false`) or
* with an array of objects.
*/
/**
* Set the document projection.
*
* See: https://github.com/louischatriot/nedb#projections
*/
project(projection: Projection<TSchema>): this;
}
update<T>(
query: any,
updateQuery: any,
options?: Nedb.UpdateOptions & { returnUpdatedDocs?: false }
): Promise<number>
interface FindCursor<TSchema> extends AbstractCursor<TSchema>, Promise<TSchema[]> {
/**
* Execute the cursor.
*
* Since the Cursor has a `then` and a `catch` method
* JavaScript identifies it as a thenable object
* thus you can await it in async functions.
*
* @example
* // in an async function
* await datastore.find(...)
* .sort(...)
* .limit(...)
*
* @example
* // the previous is the same as:
* await datastore.find(...)
* .sort(...)
* .limit(...)
* .exec()
*/
exec(): Promise<TSchema[]>;
}
update<T>(
query: any,
updateQuery: any,
options?: Nedb.UpdateOptions & { returnUpdatedDocs: true; multi?: false }
): Promise<T & Document>
interface FindOneCursor<TSchema> extends AbstractCursor<TSchema>, Promise<TSchema | null> {
/**
* Execute the cursor.
*
* Since the Cursor has a `then` and a `catch` method
* JavaScript identifies it as a thenable object
* thus you can await it in async functions.
*
* @example
* // in an async function
* await datastore.find(...)
* .sort(...)
* .limit(...)
*
* @example
* // the previous is the same as:
* await datastore.find(...)
* .sort(...)
* .limit(...)
* .exec()
*/
exec(): Promise<TSchema | null>;
}
update<T>(
query: any,
updateQuery: any,
options?: Nedb.UpdateOptions & { returnUpdatedDocs: true; multi: true }
): Promise<(T & Document)[]>
type DatastoreOptions = {
/**
* Path to the file where the data is persisted. If left blank, the
* datastore is automatically considered in-memory only. It cannot end
* with a `~` which is used in the temporary files NeDB uses to perform
* crash-safe writes.
*/
filename?: string;
/**
* Remove documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#removing-documents
*/
remove(query: any, options: Nedb.RemoveOptions): Promise<number>
/**
* As the name implies...
*
* Defaults to `false`.
*/
inMemoryOnly?: boolean;
/**
* Timestamp the insertion and last update of all documents, with the
* fields createdAt and updatedAt. User-specified values override
* automatic generation, usually useful for testing.
*
* Defaults to `false`.
*/
timestampData?: boolean;
/**
* If used, the database will automatically be loaded from the datafile
* upon creation (you don't need to call `load`). Any command issued
* before load is finished is buffered and will be executed when load is
* done.
*
* Defaults to `false`.
*/
autoload?: boolean;
/**
* If you use autoloading, this is the handler called after `load`. It
* takes one error argument. If you use autoloading without specifying
* this handler, and an error happens during load, an error will be
* thrown.
*/
onload?(error: Error): any;
/**
* Hook you can use to transform data after it was serialized and before
* it is written to disk. Can be used for example to encrypt data before
* writing database to disk. This function takes a string as parameter
* (one line of an NeDB data file) and outputs the transformed string,
* which must absolutely not contain a `\n` character (or data will be
* lost).
*/
afterSerialization?(line: string): string;
/**
* Inverse of afterSerialization. Make sure to include both and not just
* one or you risk data loss. For the same reason, make sure both
* functions are inverses of one another.
*
* Some failsafe mechanisms are in place to prevent data loss if you
* misuse the serialization hooks: NeDB checks that never one is declared
* without the other, and checks that they are reverse of one another by
* testing on random strings of various lengths. In addition, if too much
* data is detected as corrupt, NeDB will refuse to start as it could mean
* you're not using the deserialization hook corresponding to the
* serialization hook used before.
*/
beforeDeserialization?(line: string): string;
/**
* Between 0 and 1, defaults to 10%. NeDB will refuse to start if more
* than this percentage of the datafile is corrupt. 0 means you don't
* tolerate any corruption, 1 means you don't care.
*/
corruptAlertThreshold?: number;
/**
* Compares strings `a` and `b` and returns -1, 0 or 1. If specified, it
* overrides default string comparison which is not well adapted to non-US
* characters in particular accented letters. Native `localCompare` will
* most of the time be the right choice.
*/
compareStrings?(a: string, b: string): number;
/**
* If you are using NeDB from whithin a Node Webkit app, specify its name
* (the same one you use in the package.json) in this field and the
* filename will be relative to the directory Node Webkit uses to store
* the rest of the application's data (local storage etc.). It works on
* Linux, OS X and Windows. Now that you can use
* `require('nw.gui').App.dataPath` in Node Webkit to get the path to the
* data directory for your application, you should not use this option
* anymore and it will be removed.
* @deprecated
*/
nodeWebkitAppName?: string;
}
/**
* Count all documents matching the query
* @param query MongoDB-style query
*/
count(query: any): Promise<number>
type UpdateOptions = {
/**
* Allows the modification of several documents if set to `true`.
*
* Defaults to `false`.
*/
multi?: boolean;
/**
* Ensure an index is kept for this field. Same parameters as lib/indexes
* For now this function is synchronous, we need to test how much time it takes
* We use an async API for consistency with the rest of the code
*/
ensureIndex(options: Nedb.EnsureIndexOptions): Promise<undefined>
/**
* If you want to insert a new document corresponding to the `update` rules
* if your `query` doesn't match anything. If your `update` is a simple object
* with no modifiers, it is the inserted document. In the other case, the
* `query` is stripped from all operator recursively, and the `update` is
* applied to it.
*
* Defaults to `false`.
*/
upsert?: boolean;
/**
* Remove an index
*/
removeIndex(fieldName: string): Promise<undefined>
/**
* Create a database instance.
*
* Use this over `new Datastore(...)` to access
* original nedb datastore properties, such as
* `datastore.persistence`.
*
* For more information visit:
* https://github.com/louischatriot/nedb#creatingloading-a-database
*/
static create(pathOrOptions?: string | Nedb.DatastoreOptions): Datastore
}
declare namespace Nedb {
interface Cursor<T> extends Promise<T[]> {
sort(query: any): Cursor<T>
skip(n: number): Cursor<T>
limit(n: number): Cursor<T>
projection(projection: {[p in keyof T | '_id' | 'createdAt' | 'updatedAt']?:number}): Cursor<T>
exec(): Promise<T[]>
/**
* (Not MongoDB-compatible) If set to true and update is not an upsert,
* will return the document or the array of documents (when multi is set
* to `true`) matched by the find query and updated. Updated documents
* will be returned even if the update did not actually modify them.
*
* Defaults to `false`.
*/
returnUpdatedDocs?: boolean;
}
interface DatastoreOptions {
filename?: string // Optional, datastore will be in-memory only if not provided
inMemoryOnly?: boolean // Optional, default to false
nodeWebkitAppName?: boolean // Optional, specify the name of your NW app if you want options.filename to be relative to the directory where
autoload?: boolean // Optional, defaults to false
// Optional, if autoload is used this will be called after the load database with the error object as parameter. If you don't pass it the error will be thrown
onload?(error: Error): any
// (optional): hook you can use to transform data after it was serialized and before it is written to disk.
// Can be used for example to encrypt data before writing database to disk.
// This function takes a string as parameter (one line of an NeDB data file) and outputs the transformed string, which must absolutely not contain a \n character (or data will be lost)
afterSerialization?(line: string): string
// (optional): reverse of afterSerialization.
// Make sure to include both and not just one or you risk data loss.
// For the same reason, make sure both functions are inverses of one another.
// Some failsafe mechanisms are in place to prevent data loss if you misuse the serialization hooks:
// NeDB checks that never one is declared without the other, and checks that they are reverse of one another by testing on random strings of various lengths.
// In addition, if too much data is detected as corrupt,
// NeDB will refuse to start as it could mean you're not using the deserialization hook corresponding to the serialization hook used before (see below)
beforeDeserialization?(line: string): string
// (optional): between 0 and 1, defaults to 10%. NeDB will refuse to start if more than this percentage of the datafile is corrupt.
// 0 means you don't tolerate any corruption, 1 means you don't care
corruptAlertThreshold?: number
// (optional, defaults to false)
// timestamp the insertion and last update of all documents, with the fields createdAt and updatedAt. User-specified values override automatic generation, usually useful for testing.
timestampData?: boolean
type RemoveOptions = {
/**
* Allows the removal of multiple documents if set to true.
*
* Defaults to `false`.
*/
multi?: boolean;
}
/**
* multi (defaults to false) which allows the modification of several documents if set to true
* upsert (defaults to false) if you want to insert a new document corresponding to the update rules if your query doesn't match anything
*/
interface UpdateOptions {
multi?: boolean
upsert?: boolean
returnUpdatedDocs?: boolean
}
type IndexOptions = {
/**
* The name of the field to index. Use the dot notation to index a field
* in a nested document.
*/
fieldName: string;
/**
* options only one option for now: multi which allows the removal of multiple documents if set to true. Default is false
*/
interface RemoveOptions {
multi?: boolean
}
/**
* Enforce field uniqueness. Note that a unique index will raise an error
* if you try to index two documents for which the field is not defined.
*/
unique?: boolean;
interface EnsureIndexOptions {
fieldName: string
unique?: boolean
sparse?: boolean
/**
* Don't index documents for which the field is not defined. Use this
* option along with `unique` if you want to accept multiple documents for
* which it is not defined.
*/
sparse?: boolean;
/**
* If set, the created index is a TTL (time to live) index, that will
* automatically remove documents when the system date becomes larger than
* the date on the indexed field plus `expireAfterSeconds`. Documents where
* the indexed field is not specified or not a Date object are ignored.
*/
expireAfterSeconds?: number;
}
interface Persistence {
compactDatafile(): void
setAutocompactionInterval(interval: number): void
stopAutocompaction(): void
class Datastore<TDocument> extends EventEmitter {
persistence: Persistence;
private constructor();
/**
* Create a database instance.
*
* Use this over `new Datastore(...)` to access original nedb datastore
* properties, such as `datastore.persistence`.
*
* For more information visit:
* https://github.com/louischatriot/nedb#creatingloading-a-database
*/
static create(
pathOrOptions: DatastoreOptions & { timestampData: true },
): Datastore<{ _id: string, createdAt: Date, updatedAt: Date }>;
/**
* Create a database instance.
*
* Use this over `new Datastore(...)` to access original nedb datastore
* properties, such as `datastore.persistence`.
*
* For more information visit:
* https://github.com/louischatriot/nedb#creatingloading-a-database
*/
static create(
pathOrOptions?: string | DatastoreOptions,
): Datastore<{ _id: string }>;
/**
* Load the datastore.
*
* Note that you don't necessarily have to call
* this method to load the datastore as it will
* automatically be called and awaited on any
* operation issued against the datastore
* (i.e.: `find`, `findOne`, etc.).
*/
load(): Promise<void>;
/**
* Find documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#finding-documents
*
* There are differences minor in how the cursor works though.
*
* @example
* datastore.find({ ... }).sort({ ... }).exec().then(...)
*
* @example
* datastore.find({ ... }).sort({ ... }).then(...)
*
* @example
* // in an async function
* await datastore.find({ ... }).sort({ ... })
*/
find<TSchema>(
query: Query,
projection?: Projection<TDocument & TSchema>,
): FindCursor<TDocument & TSchema>;
/**
* Find a document that matches a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#finding-documents
*
* @example
* datastore.findOne({ ... }).then(...)
*
* @example
* // in an async function
* await datastore.findOne({ ... }).sort({ ... })
*/
findOne<TSchema>(
query: Query,
projection?: Projection<TDocument & TSchema>,
): FindOneCursor<TDocument & TSchema>;
/**
* Insert a document.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#inserting-documents
*/
insert<TSchema>(
docs: TSchema,
): Promise<TDocument & TSchema>;
/**
* Insert an array of documents.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#inserting-documents
*/
insert<TSchema>(
docs: TSchema[],
): Promise<(TDocument & TSchema)[]>;
/**
* Update a document that matches a query.
* Insert a new document corresponding to the `update` rules
* if no matching document was found.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#updating-documents
*/
update<TSchema>(
query: Query,
update: Update,
options: UpdateOptions & { returnUpdatedDocs: true; upsert: true; multi?: false },
): Promise<TDocument & TSchema>;
/**
* Update a document that matches a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#updating-documents
*/
update<TSchema>(
query: Query,
update: Update,
options: UpdateOptions & { returnUpdatedDocs: true; upsert?: false; multi?: false },
): Promise<(TDocument & TSchema) | null>;
/**
* Update documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#updating-documents
*/
update<TSchema>(
query: Query,
update: Update,
options: UpdateOptions & { returnUpdatedDocs: true; multi: true },
): Promise<(TDocument & TSchema)[]>;
/**
* Update documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#updating-documents
*/
update<TSchema>(
query: Query,
update: Update,
options?: UpdateOptions,
): Promise<number>;
/**
* Update documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#updating-documents
*/
update(
query: Query,
update: Update,
options?: UpdateOptions,
): Promise<number>;
/**
* Remove documents that match a query.
*
* It's basically the same as the original:
* https://github.com/louischatriot/nedb#removing-documents
*/
remove(query: Query, options: RemoveOptions): Promise<number>;
/**
* Count all documents matching the query.
*/
count(query: Query): Promise<number>;
/**
* Ensure an index is kept for this field. Same parameters as lib/indexes
* For now this function is synchronous, we need to test how much time it
* takes We use an async API for consistency with the rest of the code.
*/
ensureIndex(options: IndexOptions): Promise<void>;
/**
* Remove an index.
*/
removeIndex(fieldName: string): Promise<void>;
}
}
export default NeDB.Datastore;
{
"name": "nedb-promises",
"version": "5.0.3",
"version": "6.0.0-pre",
"description": "A dead-simple promise wrapper for nedb.",

@@ -32,6 +32,6 @@ "main": "index.js",

"devDependencies": {
"eslint": "^8.2.0",
"jest": "^27.3.1",
"jsdoc-to-markdown": "^7.0.1"
"eslint": "^8.6.0",
"jest": "^27.4.7",
"jsdoc-to-markdown": "^7.1.0"
}
}

@@ -1,2 +0,1 @@

![nedb-promises](https://github.com/bajankristof/nedb-promises/blob/master/logo.svg "nedb-promises")

@@ -51,5 +50,6 @@

### Usage
Everything works as the original module, with four major exceptions.
Everything works as the original module, with a couple of exceptions:
* There are no callbacks.
* `loadDatabase` has been renamed to `load`.
* `loadDatabase` has been renamed to [`load`](https://github.com/bajankristof/nedb-promises/blob/master/docs.md#Datastore+load).
* The cursor's `projection` method has been renamed to [`project`](https://github.com/bajankristof/nedb-promises/blob/master/docs.md#Cursor+project).
* You should call `Datastore.create(...)` instead of `new Datastore(...)`. This way you can access the original [nedb](https://github.com/louischatriot/nedb#readme) properties, such as `datastore.persistence`.

@@ -56,0 +56,0 @@ * As of v2.0.0 the module supports events 😎... Check out the [docs about events](https://github.com/bajankristof/nedb-promises/blob/master/docs.md#Datastore)!

@@ -47,4 +47,4 @@ const OriginalCursor = require('@seald-io/nedb/lib/cursor');

*/
sort() {
this.__original.sort.apply(this.__original, arguments);
sort(...args) {
this.__original.sort(...args);
return this;

@@ -60,4 +60,4 @@ }

*/
skip() {
this.__original.skip.apply(this.__original, arguments);
skip(...args) {
this.__original.skip(...args);
return this;

@@ -73,4 +73,4 @@ }

*/
limit() {
this.__original.limit.apply(this.__original, arguments);
limit(...args) {
this.__original.limit(...args);
return this;

@@ -80,9 +80,16 @@ }

/**
* Set the document projection.
*
* See: https://github.com/louischatriot/nedb#projections
*
* @return {Cursor}
*/
project(...args) {
this.__original.projection(...args);
return this;
}
/**
* Execute the cursor.
*
* You can use the same cursor methods
* that you could with the original module:
*
* https://github.com/louischatriot/nedb#sorting-and-paginating
*
* Since the Cursor has a `then` and a `catch` method

@@ -89,0 +96,0 @@ * JavaScript identifies it as a thenable object

const fs = require('fs');
const path = require('path');
const Datastore = require('../src/Datastore');
const root = path.dirname(__dirname);
describe('testing datastore creation', () => {

@@ -8,0 +5,0 @@ describe('new Datastore(\'foo.db\')', () => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc