evaluate
========
Evaluate your variables, with a simples function.
This is a simple way to check if a variable is setted and evaluate
a value default depends the type of the variable.
Instalation
npm install --save evaluate
How to use
evaluate(vari, type, default)
The evaluate function need a variable and a type to works. In other cases it will throw an error. You can send a default value to the variable if the current variable is undefined.
var evaluate = ; { vari = ; varDate = ; varInt = ; console; // '', Thu Sep 17 2015 15:04:56 GMT-0300 (BRT), 10 }
Supported Types
Number
; // If vari is undefined and default is not send the returned value is 0
String
; // If vari is undefined and default is not send the returned value is ''
Boolean
; // If vari is undefined and default is not send the returned value is false
Date
; // If vari is undefined and default is not send the returned value is the current date
Object
; // If vari is undefined and default is not send the returned value is {}
Array
; // If vari is undefined and default is not send the returned value is []