Comparing version 3.6.0 to 3.6.1
{ | ||
"name": "table", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"description": "Formats data into a string table.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -16,2 +16,3 @@ <h1 id="table">Table</h1> | ||
* [Predefined Border Templates](#table-usage-predefined-border-templates) | ||
* [Streaming](#table-usage-streaming) | ||
* [Text Truncation](#table-usage-text-truncation) | ||
@@ -455,2 +456,33 @@ * [Text Wrapping](#table-usage-text-wrapping) | ||
<h3 id="table-usage-streaming">Streaming</h3> | ||
`table` package exports `createStream` function used to draw a table and append rows. | ||
`createStream` requires `{number} columnDefault.width` and `{number} columnCount` configuration properties. | ||
```js | ||
import { | ||
createStream | ||
} from 'table'; | ||
let config, | ||
stream; | ||
config = { | ||
columnDefault: { | ||
width: 50 | ||
}, | ||
columnCount: 1 | ||
}; | ||
stream = createStream(config); | ||
setInterval(() => { | ||
stream.write([new Date()]); | ||
}, 500); | ||
``` | ||
![Streaming current date.](./.README/streaming.gif) | ||
`table` package uses ANSI escape codes to overwrite the output of the last line when a new row is printed. The underlying logic is explained in this [Stack Overflow answer](http://stackoverflow.com/a/32938658/368691). | ||
<h3 id="table-usage-text-truncation">Text Truncation</h3> | ||
@@ -457,0 +489,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
537694
564