4.0.0 • Published 2 years ago

bookman v4.0.0

Weekly downloads
439
License
MIT
Repository
github
Last release
2 years ago

stars license supportServer forks issues

✨ BookmanDB: An Easy-To-Use JSON Database

  • BookmanDB is a very easy to use and easily editable JSON database module that allows you to create unlimited amount of unique database files!
  • BookmanDB also saves your data in a json file so you can access and edit simple files at any time.

📦 Installation

  • Using yarn: yarn add bookman
  • Using npm: npm i bookman

🤓 Usage

/* BookmanDB Files */
const { Database, FSAdapter } = require("bookman");
/* Creating New Database */
const fsAdapter = new FSAdapter({
	defaultDir: "database",
	databaseName: "mydb",
});
const db = new Database(fsAdapter);

/* Setting a value in the database */
db.set("just.a.long.data.name", "Bookman is cool!"); // => "Bookman is cool!"
db.set("just.a.long.array", []); // => []
db.set("just.a.long.number", 1); // => 1

/* Getting a value in the database */
db.get("just.a.long.data"); // => { name: "Bookman is cool!" }
db.fetch("just.a.long.number"); // => 1

/* Check if data created */
db.has("just.a.long"); // => true
db.has("just.a.long.name"); // => false

/* Add specified data */
db.add("just.a.long.number", 1); // => 2
db.add("just.a.long.number", 5); // => 7

/* Subtract specified data */
db.subtract("just.a.long.number", 1); // => 6
db.subtract("just.a.long.number", 3); // => 3

/* Push specified data */
db.push("just.a.long.array", 2); // => [2]
db.push("just.a.long.array", null); // => [2, null, 3, "str1", {}]
db.push("just.a.long.array", 3); // => [2, null, 3]
db.push("just.a.long.array", "str1"); // => [2, null, 3, "str1"]
db.push("just.a.long.array", {}); // => [2, null, 3, "str1", {}]

/* Pop specified data */
db.pop("just.a.long.array"); // => [2, null, 3, "str1"]

/* Shift specified data */
db.shift("just.a.long.array"); // => [null, 3, "str1"]

/* Unshift specified data */
db.unshift("just.a.long.array", 5); // => [5, null, 3, "str1"]

/* Mapping data */
db.map(); // =>  { just: { a: { long: [Object] } } }

/* Deleting a value in the database */
db.delete("just.a.long"); // => { just: { a: { long: [Object] } } } has been deleted

/* Destroying database */
db.destroy(); // true

📄 License

Copyright © 2021 Barış DEMİRCİ.

Distributed under the MIT License. See LICENSE for more information.

🧦 Contributing

Fell free to use GitHub's features.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/my-feature)
  3. Run prettier and eslint (npm run format && npm run lint)
  4. Commit your Changes (git commit -m 'my awesome feature my-feature')
  5. Push to the Branch (git push origin feature/my-feature)
  6. Open a Pull Request

🔥 Show your support

Give a ⭐️ if this project helped you!

📞 Contact

3.3.3

2 years ago

4.0.0

2 years ago

3.3.2

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.6.4

4 years ago

1.6.0

4 years ago

1.5.2

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago