1.0.1 • Published 4 years ago

quick.db-prototypes v1.0.1

Weekly downloads
34
License
MIT
Repository
github
Last release
4 years ago

Quick.db Prototypes

Prototypes for quick.db.

Installation

$ npm i quick.db-prototypes

Example

const db = require("quick.db");
require("quick.db-prototypes")(db);

// access to db.startsWith
const data = db.startsWith("something", { sort: ".data" });
console.log(data);

Available Methods

db.startsWith(key, options?)

This method is identical to old db.startsWith() method. Example:

db.startsWith("something", { sort: ".data" });

db.deleteAll(key?, options?)

This method can be used to remove identical keys or entire table. Example:

db.deleteAll("someMatchingKey");

// or

db.deleteAll(); // delete entire table

db.pull(key, items | items[], options?)

This method can be used to remove items from array. Key must be a valid key and items can be a single or multiple (array). Example:

db.set("something", ["hello", "world", "hi", "hi", "ping"]);

db.pull("something", "hi"); // ["hello", "world", "ping"]
db.pull("something", ["hello", "world"]); // ["ping"]

db.setMany(items[], options?)

This method can be used to set multiple data at once. This method takes Array of data containing key and value pair as data. Example:

const data = [
    { key: "test_1", value: "hello1" },
    { key: "test_2", value: "hello2" },
    { key: "test_3", value: "hello3" },
    { key: "test_4", value: "hello4" },
    { key: "test_5", value: "hello5" },
    { key: "test_6", value: "hello6" },
    { key: "test_7", value: "hello7" },
    { key: "test_8", value: "hello8" },
    { key: "test_9", value: "hello9" }
];

db.setMany(data);

More features coming soon

Discord Server

npm.io

-> Plexi Development (quick.db)

1.0.1

4 years ago

1.0.0

4 years ago