tty-table 4.2.0 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/adapters/terminal-adapter.js +8 -2
- package/package.json +1 -1
- package/src/factory.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tty-table 端子台
|
|
2
2
|
|
|
3
|
-
[](http://badge.fury.io/js/tty-table) [](https://coveralls.io/github/tecfu/tty-table?branch=master)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Display your data in a table using a terminal, browser, or browser console.
|
|
@@ -111,15 +111,21 @@ const runTable = function (header, body) {
|
|
|
111
111
|
previousHeight = t1.height
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
const chunks = []
|
|
114
115
|
process.stdin.resume()
|
|
115
116
|
process.stdin.setEncoding("utf8")
|
|
116
117
|
process.stdin.on("data", function (chunk) {
|
|
118
|
+
chunks.push(chunk)
|
|
119
|
+
})
|
|
120
|
+
process.stdin.on("end", function () {
|
|
121
|
+
const stdin = chunks.join("")
|
|
122
|
+
|
|
117
123
|
// handle dataFormats
|
|
118
124
|
switch (true) {
|
|
119
125
|
case (dataFormat === "json"):
|
|
120
126
|
let data
|
|
121
127
|
try {
|
|
122
|
-
data = JSON.parse(
|
|
128
|
+
data = JSON.parse(stdin)
|
|
123
129
|
} catch (e) {
|
|
124
130
|
emitError(
|
|
125
131
|
"JSON parse error",
|
|
@@ -136,7 +142,7 @@ process.stdin.on("data", function (chunk) {
|
|
|
136
142
|
}
|
|
137
143
|
})
|
|
138
144
|
|
|
139
|
-
csv.parse(
|
|
145
|
+
csv.parse(stdin, formatterOptions, function (err, data) {
|
|
140
146
|
// validate csv
|
|
141
147
|
if (err || typeof data === "undefined") {
|
|
142
148
|
emitError(
|
package/package.json
CHANGED