Package Exports
- jsonbases
- jsonbases/jsonbase.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jsonbases) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
JsonBases
Jsonbases - local database provides developers to create a tables on json.
🚀 Get started
import jsonbases from 'jsonbases';
// User data format
const user = {
types: {
name: 'string',
age: 'number',
married: 'boolean'
},
requireds: [
'name',
'age'
]
};
// Create user table named "users"
const users = jsonbases('users', format);
// Create user
const newUser = users.createItem();
newUser.name = 'John';
newUser.age = 25;
// Insert user into table
users.add(newUser);
// Find user by name
const allJohn = users.findAll({ name: 'John' });
console.log(allJohn);
//etc.Features
Saves your time - no need to learn, install, create connections, sign up for other databases.
Easy to use - simple intuitive functions to manage with your tables.
Fast to work - simplicity of this tool makes your work more faster.
Functions
createItem() Creates a new item with properties initialized to null based on the defined data format.
add(item) Adds a new item to the database if it conforms to the specified data format.
find(item) Finds and returns an item in the database based on the provided ID.
findAll(item) Finds and returns an array of items in the database based on the provided criteria. Optionally removes items that meet specific conditions.
findAll(item, remover) Optionally removes items that meet specific conditions.
update(item) Updates an existing item in the database with the provided data and original ID.
updateAll(list) Updates multiple items in the database based on the provided list and original IDs in it.
remove(item) Removes an item from the database based on the provided criteria.
removeAll(item) Removes all items from the database that match the provided criteria.
getAll() Returns an array containing all items in the database.
resetTable() Resets the entire table, removing all items.
Developed with ❤️ in Budapest