+21
-7
| /// <reference path="./index.ts" /> | ||
| var tableHelpers = { | ||
| makeRow: function (cellCounterArg, colorArg) { | ||
| if (cellCounterArg === void 0) { cellCounterArg = 2; } | ||
| if (colorArg === void 0) { colorArg = "cyan"; } | ||
| var rowArray = []; | ||
| for (var i = 0; i < (cellCounterArg); i++) { | ||
| rowArray.push(String(i + 1).cyan); | ||
| } | ||
| return rowArray; | ||
| } | ||
| }; | ||
| var ConsoleTable = (function () { | ||
| function ConsoleTable(tableType) { | ||
| switch (tableType) { | ||
| function ConsoleTable(tableTypeArg, tableHeadArrayArg) { | ||
| if (tableHeadArrayArg === void 0) { tableHeadArrayArg = tableHelpers.makeRow(); } | ||
| switch (tableTypeArg) { | ||
| case "checks": | ||
| this.tableHead = ['Check Item:'.cyan, 'Status:'.cyan]; | ||
| break; | ||
| case "custom": | ||
| this.tableHead = tableHeadArrayArg; | ||
| break; | ||
| default: | ||
@@ -12,3 +27,3 @@ break; | ||
| this.rows = []; | ||
| this.type = tableType; | ||
| this.type = tableTypeArg; | ||
| } | ||
@@ -20,4 +35,3 @@ ConsoleTable.prototype.push = function (row) { | ||
| var table = new BeautylogOsTable.cliTable({ | ||
| head: this.tableHead, | ||
| colWidths: [20, 20] | ||
| head: this.tableHead | ||
| }); | ||
@@ -159,4 +173,4 @@ for (var row in this.rows) { | ||
| var beautylogOsTable = {}; | ||
| beautylogOsTable.new = function (type) { | ||
| var newConsoleTable = new ConsoleTable(type); | ||
| beautylogOsTable.new = function (typeArg, tableHeadArrayArg) { | ||
| var newConsoleTable = new ConsoleTable(typeArg, tableHeadArrayArg); | ||
| return newConsoleTable; | ||
@@ -163,0 +177,0 @@ }; |
+1
-1
| { | ||
| "name": "beautylog", | ||
| "version": "1.0.6", | ||
| "version": "1.0.7", | ||
| "description": "beautiful logging", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+17
-2
@@ -33,5 +33,9 @@ # beautylog | ||
| There are different types of tables. | ||
| #### Custom | ||
| ```javascript | ||
| var bl = require('beautylog')("os"); //for use in OS console environment | ||
| var myTable = bl.table.new("checks"); //you can specify a format like "checks" to trigger things like the green and red badges | ||
| var myTable = bl.table.new("custom",["Heading1".blue,"Heading2".blue,"Heading3".blue]); // type "custom" | ||
| myTable.push(["check 1","success"]); // adds a row the myTable | ||
@@ -43,3 +47,14 @@ myTable.push(["check 2","error"]); // adds a row the myTable | ||
| The table from the code above looks like this: | ||
| #### Checks | ||
| ```javascript | ||
| var bl = require('beautylog')("os"); //for use in OS console environment | ||
| var myTable = bl.table.new("checks"); // type checks | ||
| myTable.push(["check 1","success"]); // adds a row the myTable | ||
| myTable.push(["check 2","error"]); // adds a row the myTable | ||
| myTable.push(["check 3","error"]); // adds a row the myTable | ||
| myTable.print(); //prints myTable to the console | ||
| ``` | ||
| The table from the code with type "checks" above looks like this: | ||
|  |
+10
-5
@@ -29,7 +29,12 @@ /// <reference path="./typings/tsd.d.ts" /> | ||
| console.log("*** start table test ***"); | ||
| var testTable = beautyLogOs.table.new("checks"); | ||
| testTable.push(['check1', 'success']); | ||
| testTable.push(['check2', 'error']); | ||
| testTable.push(['check3', 'error']); | ||
| testTable.print(); | ||
| (function () { | ||
| var testTable1 = beautyLogOs.table.new("checks"); | ||
| testTable1.push(['check1', 'success']); | ||
| testTable1.push(['check2', 'error']); | ||
| testTable1.push(['check3', 'error']); | ||
| testTable1.print(); | ||
| var testTable2 = beautyLogOs.table.new("custom", ["Column1".red, "Column2".blue, "Column3".cyan]); | ||
| testTable2.push(["Hey", "this", "works"]); | ||
| testTable2.print(); | ||
| })(); | ||
| console.log("*** end table test ***"); |
| /// <reference path="./index.ts" /> | ||
| var tableHelpers = { | ||
| makeRow: function(cellCounterArg:number = 2,colorArg:string = "cyan"){ | ||
| var rowArray = []; | ||
| for (var i = 0; i < (cellCounterArg); i++) { | ||
| rowArray.push(String(i + 1).cyan); | ||
| } | ||
| return rowArray; | ||
| } | ||
| }; | ||
@@ -7,7 +16,10 @@ class ConsoleTable { | ||
| type:string; | ||
| constructor(tableType:string) { | ||
| switch (tableType) { | ||
| constructor(tableTypeArg:string,tableHeadArrayArg:string[] = tableHelpers.makeRow()) { | ||
| switch (tableTypeArg) { | ||
| case "checks": | ||
| this.tableHead = ['Check Item:'.cyan,'Status:'.cyan]; | ||
| break; | ||
| case "custom": | ||
| this.tableHead = tableHeadArrayArg; | ||
| break; | ||
| default: | ||
@@ -17,3 +29,3 @@ break; | ||
| this.rows = []; | ||
| this.type = tableType; | ||
| this.type = tableTypeArg; | ||
| } | ||
@@ -25,4 +37,3 @@ push(row:string[]){ | ||
| var table = new BeautylogOsTable.cliTable({ | ||
| head: this.tableHead, | ||
| colWidths: [20, 20] | ||
| head: this.tableHead | ||
| }); | ||
@@ -29,0 +40,0 @@ for (var row in this.rows){ |
@@ -8,4 +8,4 @@ /// <reference path="./index.ts" /> | ||
| beautylogOsTable.new = function(type:string) { | ||
| var newConsoleTable = new ConsoleTable(type); | ||
| beautylogOsTable.new = function(typeArg:string,tableHeadArrayArg?) { | ||
| var newConsoleTable = new ConsoleTable(typeArg,tableHeadArrayArg); | ||
| return newConsoleTable; | ||
@@ -12,0 +12,0 @@ }; |
+14
-5
@@ -36,7 +36,16 @@ /// <reference path="./typings/tsd.d.ts" /> | ||
| console.log("*** start table test ***"); | ||
| var testTable = beautyLogOs.table.new("checks"); | ||
| testTable.push(['check1','success']); | ||
| testTable.push(['check2','error']); | ||
| testTable.push(['check3','error']); | ||
| testTable.print(); | ||
| (function(){ | ||
| var testTable1 = beautyLogOs.table.new("checks"); | ||
| testTable1.push(['check1','success']); | ||
| testTable1.push(['check2','error']); | ||
| testTable1.push(['check3','error']); | ||
| testTable1.print(); | ||
| var testTable2 = beautyLogOs.table.new("custom",["Column1".red,"Column2".blue,"Column3".cyan]); | ||
| testTable2.push(["Hey","this","works"]); | ||
| testTable2.print(); | ||
| })(); | ||
| console.log("*** end table test ***"); |
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
117802
1.65%2608
1.36%58
34.88%