0.0.1 • Published 6 years ago
data-factory v0.0.1
Data Factory Javascript
Manage data and stack easily with data-factory
Install
npm install --save data-factory
Usage
Create as much data that you need and manage them in one instance.
const dataFactory = require('data-factory');
var data = new dataFactory;
data.set('Wait why ? I have not key ?') // set data to local data
data.push('coucou'); // set data to local stack
data.push('my');
data.push('Bread');
data.set('toto', 'tutu'); // set 'toto' key and 'tutu' value
data.set('tutu', ['toto']);
data.tutu.push('test'); // get tutu instance created before and push to local stack in tutu instance
data.set('parent', 'I am THE parent');
data.parent.set('child', 'Am I the child ?');
data.parent.concat(['pop me', 'and me too']);
data.parent.pop(1); // remove element from stack
data.parent.pop();
data.set('removeMe', 'data')
data.unset('removeMe'); // remove instance + data
console.log(data.get()); // get local data
console.log(data.get('tutu')); // get tutu data (data.tutu to get tutu instance)
console.log(data.tutu.getStack());
console.log(data.get('parent'));
console.log(data.parent.get('child'));
console.log(data.parent.getStack());
console.log(data.get('removeMe'));
console.log(data.getStack()); // get stack list
console.log(data.getAll()); // get all data from instance
Functions
Name | Description | Additionnal |
---|---|---|
set(key: string , data: any ) : current | Add data in key from current instance and create key instance | |
unset(key: string ) : current | Remove data in key from current instance and remove key instance | |
push(data: any ) : current | Push data in stack from current instance | |
concat(data: any ) : current | Concat data with local stack from current instance | |
pop(key: number ) : current | Remove element from stack | |
get(key: string ) : current | Get specific data from current instance | |
getStack() : current | Get all local stack from current instance | |
getAll() : current | Get all local data from current instance |
0.0.1
6 years ago