:beginner: JSONDB, but worse. Does JSONDB even exist? Probably not, but if it does not, then I am forecasting its creation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Luiserebii 225f60681b
Adding total alerts LGTM
2 months ago
scripts Moved script out, changed script to copy files from project root directory, and not based on working directory (IMPORTANT CHANGE) 2 months ago
src Finally fixed; aside from the comment added in this commit, see: https://stackoverflow.com/questions/13407036/how-does-interfaces-with-construct-signatures-work 2 months ago
test Initial commit 3 months ago
.gitignore Adding dist to .gitignore 2 months ago
.travis.yml Adding .travis.yml 2 months ago
LICENSE Adding LICENSE 3 months ago
README.md Adding total alerts LGTM 2 months ago
package-lock.json Migrating to typescript files 2 months ago
package.json Bumping up to v0.2.0 now that everything compiles well in TypeScript~ 2 months ago
tsconfig.json Adding surpress implicit error to tsconfig 2 months ago

README.md

JSONDB, but worse

npm version Build Status Total alerts

This project is the result of a misguided attempt to create a kind of JSON database API for, well, data storage, stored as JSONs.

It is a very small, short project, which should get the job done. The simple idea is, extend the ObjectDB class, and build on top of the write/load functions. They are fairly simple, and self-explanatory (I hope).

Technical Details

Data objects, or objects meant to be stored in the DB, must extend class JSONData, which guarantees the existence of the toJSON() function. Any JSONData classes must also be prepared to accept a JSON in the constructor, as this is the construction used in order to load JSON objects from file to memory.

The code should clear this up, in case this doesn’t make sense. The end result would be to simplify the code to something like:

db.saveData(records, './data', 'records.json')

And of course, you can extend the ObjectDB class and build any OOP abstractions to simplify the above as you like (such as setting default directory and filenames).

Developing

To test which files will be published, please use the script written instead of npm pack to allow for correct packing. These have been conveniently placed in npm scripting under the following: npm run n-pack npm run n-publish

And an additional convenience command: npm run clean

will simply delete the .tgz left behind by n-pack.

Advice

I really don’t recommend you use this, it is flawed and very underdeveloped, but if you enjoy the attempted simplicity for any reason, knock yourself out. However, if you are a rational being, I highly suggest you use something actually good like LevelDB.

Contributions

Any pull requests to this would be interesting, since I’m curious to see how this can be added to/changed in terms of design, lolol.