-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.js
More file actions
25 lines (25 loc) · 826 Bytes
/
print.js
File metadata and controls
25 lines (25 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @name: print
* @description: Dumps a slightly more informative console.log of a variable
* @usage: require("./print")(); print("Varname", Varname);
* @param: "Varname" = The text description of the variable.
* @param: Varname = The variable to dump.
* @author: Mike Rightmire
* @email: Mike.Rightmire@Biocomsoftware.com
* @copyright: BiocomSoftware
* @version: 0.9.0.0
* @Licensing LGPL
*/
module.exports = function() {
this.print = function (name, a){
if ( typeof a == 'undefined' ) {
process.stdout.write("(typeof: undefined)[length:0]" );
console.log(" " + name + " = undefined");
} else {
process.stdout.write("(typeof: " + typeof a + ")");
process.stdout.write("[length:" + a.length + "]");
process.stdout.write(" " + name + " = ");
console.log(a);
}
}
}