console-grid
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -64,5 +64,7 @@ const Style = require("./style.js"); | ||
setOption(option) { | ||
var defaultOption = this.defaultOption(); | ||
if (option) { | ||
var defaultOption = this.defaultOption(); | ||
this.option = Object.assign(defaultOption, option); | ||
} else { | ||
this.option = defaultOption; | ||
} | ||
@@ -168,3 +170,6 @@ return this; | ||
var name = (column.name || column.id) + ""; | ||
var name = column.id; | ||
if (typeof (column.name) === "string") { | ||
name = column.name; | ||
} | ||
name = name.replace(/\s/g, " "); | ||
@@ -465,6 +470,2 @@ column.name = name; | ||
removeColor(char) { | ||
return char.replace(/\033\[(\d+)m/g, ''); | ||
} | ||
//https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms_(Unicode_block) | ||
@@ -583,3 +584,3 @@ //http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt | ||
line = B[position + "_left"] + borderPadding + line + borderPadding + B[position + "_right"]; | ||
this.consoleLog(line); | ||
this.addLine(line); | ||
return this; | ||
@@ -600,3 +601,4 @@ } | ||
line = B.v + borderPadding + line + borderPadding + B.v; | ||
this.consoleLog(line); | ||
this.addLine(line); | ||
return this; | ||
} | ||
@@ -626,3 +628,3 @@ | ||
line = B.v + borderPadding + line + borderPadding + B.v; | ||
this.consoleLog(line); | ||
this.addLine(line); | ||
return this; | ||
@@ -654,13 +656,24 @@ } | ||
this.renderRowBorder("bottom"); | ||
this.consoleLog(); | ||
return this.renderLines; | ||
} | ||
consoleLog(line) { | ||
addLine(line) { | ||
this.renderLines.push(line); | ||
if (this.option.silent) { | ||
return this; | ||
} | ||
consoleLog() { | ||
if (this.option.silent || !this.renderLines) { | ||
return; | ||
} | ||
console.log(line); | ||
var log = this.renderLines.join("\n"); | ||
console.log(log); | ||
} | ||
removeColor(char) { | ||
return char.replace(/\033\[(\d+)m/g, ''); | ||
} | ||
} | ||
@@ -667,0 +680,0 @@ |
{ | ||
"name": "console-grid", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "console log a grid", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -173,2 +173,7 @@ # console-grid | ||
### v1.0.16 | ||
* fixed empty name issue | ||
* fixed output log mixing | ||
* fixed option override issue | ||
### v1.0.15 | ||
@@ -175,0 +180,0 @@ * fixed invalid header name with column id |
30987
741
185