collectdb
v0.0.3
Published
A simple database for storing and managing collections of data in memory.
Downloads
3
Readme
collectdb
A simple database for storing and managing collections of data in memory.
Usage
Install package:
# ✨ Auto-detect
npx nypm install collectdb
# npm
npm install collectdb
# yarn
yarn add collectdb
# pnpm
pnpm install collectdb
# bun
bun install collectdb
Import:
ESM (Node.js, Bun)
import {} from "collectdb";
CommonJS (Legacy Node.js)
const {} = require("collectdb");
CDN (Deno, Bun and Browsers)
import {} from "https://esm.sh/collectdb";
Usage
import { createCollectDB } from "collectdb";
const initialData = {
users: [
{ id: 1, name: "John Doe" },
{ id: 2, name: "Jane Doe" },
],
};
const db = createCollectDB(initialData);
db.users.push({ id: 3, name: "Alice Doe" });
const user = db.users.firstWhere("name", "Jane Doe");
user.age = 42;
const users = db.users.where("age", 42);
const data = db.toArray();
Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
License
Published under the MIT license. Made by community 💛
🤖 auto updated with automd