Nodevar
Creates objects with steroids.
Installation
$ npm install nodevar --save-dev
Features
- Creating dynamic objects.
- History of changes in variables.
- Automatic handling of native methods.
- Observe changes.
Usage
History changes
var Nodevar = ; var pet = ; petdata = "Pecas";petdata = "Misingo"; console/**[ { val: 'Pecas', date: 2017-03-23T04:21:51.529Z }, { val: 'Misingo', date: 2017-03-23T04:21:51.529Z }]*/
Use pet.clear()
to clear the history.
Using native methods
Full control of the native methods of an object with Nodevar. The onChage
function is called when there is a state change in the variable, ie it is activated when the =
operator is used. The onGet
function is called before displaying the variable data
.
// Declare optionsvar options = data: 'Picasso' { console } { return `My pet is `; } var pet = options; petdata = "Pecas"; //=> Change Picasso to Pecaspetdata = "Misingo"; //=> Change Pecas to Misingopetdata = "Caesar"; //=> Change Misingo to Caesar console //=> My pet is Caesar console/*=>[ { val: 'Picasso', date: 2017-03-23T04:32:00.748Z }, { val: 'Pecas', date: 2017-03-23T04:32:00.757Z }, { val: 'Misingo', date: 2017-03-23T04:32:00.758Z }, { val: 'Caesar', date: 2017-03-23T04:32:00.758Z }]*/
Observe changes
Create observable variable.
var myvar = ; myvar; myvarunicorn = "white"; //=> The unicorn is white colormyvarunicorn = "pink"; //=> The unicorn is pink color
Use the method unwatch
for remove watch. ie:
myvar;
For more information see examples
License
MIT
Public Domain.