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 ?')
data.push('coucou');
data.push('my');
data.push('Bread');
data.set('toto', 'tutu');
data.set('tutu', ['toto']);
data.tutu.push('test');
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);
data.parent.pop();
data.set('removeMe', 'data')
data.unset('removeMe');
console.log(data.get());
console.log(data.get('tutu'));
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());
console.log(data.getAll());
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 | |