1.1.2 ā€¢ Published 3 months ago

deepbase v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

šŸŒ³ DeepBase

DeepBase is the fastest and simplest way to add persistence to your projects while allowing you to view information in a user-friendly format.

A powerful JSON-based storage library that allows you to store, retrieve, and modify nested objects with ease.

šŸ“¦ Installation

npm install deepbase

šŸ”§ Usage

const DeepBase = require("deepbase");
const mem = new DeepBase({ name: "db" }); // db.json

āœļø Setting Values

mem.set("config", "lang", "en");

const configLang = mem.get("config", "lang");
console.log(configLang); // "en"

āœ… Adding Rows

const path = mem.add("user", { name: "martin" });

// add() will create a secure key (ie. "iKidAOCKds")
console.log(path) // [ 'user', 'iKidAOCKds' ]

const userName = mem.get(...path, "name");
console.log(userName); // "martin"

šŸ”¢ Increment fields

mem.inc(...path, "balance", 160);
mem.inc(...path, "balance", 420);

const userBalance = mem.get(...path, "balance");
console.log(userBalance); // 580

āš—ļø Update

mem.upd("config", "lang", v => v.toUpperCase());
const lang = mem.get("config", "lang"); // EN

šŸ”„ Finally

mem.add("user", { name: "anya" });

const userIds = mem.keys("user")
console.log(userIds) // [ 'iKidAOCKds', 'FEwORvJjs' ]

console.log(mem.get()) // db.json
// {
//     config: { lang: 'EN' },
//     user: {
//         iKidAOCKds: { name: 'martin', balance: 580 },
//         FEwORvJjs: { name: 'anya' }
//     }
// }

šŸ¤Æ Features

  • šŸ” Easily access and modify nested objects in JSON storage.
  • šŸ“ Automatically save changes to a file.
  • šŸŒ± Simple and intuitive API for managing complex JSON structures.

šŸ¤” Why DeepBase

  • āš” Fastest and simplest way to add persistence to your projects.
  • šŸ“– View information in a user-friendly format.
  • šŸ§  Easy to use and understand.

šŸ¤ Contributing

Contributions to DeepBase are welcome! If you have an idea or a bug to report, please open an issue. If you would like to contribute to the code, please open a pull request.

šŸŽ¬ Conclusion

DeepBase is a powerful and flexible solution for managing complex JSON structures.

šŸš€ Try it out and simplify your code today!

šŸ“„ License

The MIT License (MIT)

Copyright (c) Martin Clasen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.1.2

3 months ago

1.1.12

4 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.9

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.2

1 year ago

0.9.8

1 year ago

0.9.6

1 year ago

0.8.6

1 year ago