Socket
Socket
Sign inDemoInstall

table

Package Overview
Dependencies
17
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.1 to 3.6.2

.README/streaming-random.gif

51

.README/usage/streaming.md

@@ -31,2 +31,51 @@ ### Streaming

`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).
`table` package uses ANSI escape codes to overwrite the output of the last line when a new row is printed.
The underlying implementation is explained in this [Stack Overflow answer](http://stackoverflow.com/a/32938658/368691).
Streaming supports all of the configuration properties and functionality of a static table, e.g.
```js
import {
createStream
} from 'table';
import _ from 'lodash';
let config,
stream,
i;
config = {
columnDefault: {
width: 50
},
columnCount: 3,
columns: {
0: {
width: 10,
alignment: 'right'
},
1: {
alignment: 'center',
},
2: {
width: 10
}
}
};
stream = createStream(config);
i = 0;
setInterval(() => {
let random;
random = _.sample('abcdefghijklmnopqrstuvwxyz', _.random(1, 30)).join('');
stream.write([i++, new Date(), random]);
}, 500);
```
![Streaming random data.](./.README/streaming-random.gif)

@@ -97,2 +97,6 @@ 'use strict';

if (subjectWidth === 0) {
return _lodash2['default'].repeat(' ', containerWidth);
}
availableWidth = containerWidth - subjectWidth;

@@ -99,0 +103,0 @@

6

dist/createStream.js

@@ -67,3 +67,3 @@ 'use strict';

return (0, _drawRow2['default'])(row, config.border);
}).join("\n");
}).join('');

@@ -93,5 +93,7 @@ output = '';

// console.log('rows', rows);
body = _lodash2['default'].map(rows, function (row) {
return (0, _drawRow2['default'])(row, config.border);
}).join("\n");
}).join('');

@@ -98,0 +100,0 @@ output = "\r\x1b[K";

{
"name": "table",
"version": "3.6.1",
"version": "3.6.2",
"description": "Formats data into a string table.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -485,3 +485,52 @@ <h1 id="table">Table</h1>

`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).
`table` package uses ANSI escape codes to overwrite the output of the last line when a new row is printed.
The underlying implementation is explained in this [Stack Overflow answer](http://stackoverflow.com/a/32938658/368691).
Streaming supports all of the configuration properties and functionality of a static table, e.g.
```js
import {
createStream
} from 'table';
import _ from 'lodash';
let config,
stream,
i;
config = {
columnDefault: {
width: 50
},
columnCount: 3,
columns: {
0: {
width: 10,
alignment: 'right'
},
1: {
alignment: 'center',
},
2: {
width: 10
}
}
};
stream = createStream(config);
i = 0;
setInterval(() => {
let random;
random = _.sample('abcdefghijklmnopqrstuvwxyz', _.random(1, 30)).join('');
stream.write([i++, new Date(), random]);
}, 500);
```
![Streaming random data.](./.README/streaming-random.gif)
<h3 id="table-usage-text-truncation">Text Truncation</h3>

@@ -488,0 +537,0 @@

@@ -87,2 +87,6 @@ import _ from 'lodash';

if (subjectWidth === 0) {
return _.repeat(` `, containerWidth);
}
availableWidth = containerWidth - subjectWidth;

@@ -89,0 +93,0 @@

@@ -37,3 +37,3 @@ import makeStreamConfig from './makeStreamConfig';

return drawRow(row, config.border);
}).join("\n");
}).join('');

@@ -63,5 +63,7 @@ output = '';

// console.log('rows', rows);
body = _.map(rows, (row) => {
return drawRow(row, config.border);
}).join("\n");
}).join('');

@@ -68,0 +70,0 @@ output = "\r\x1b[K";

@@ -46,2 +46,9 @@ /* eslint-disable max-nested-callbacks */

context(`subject parameter value`, () => {
context(`0 width`, () => {
it(`produces a string consisting of container width number of whitespace characters`, () => {
expect(alignString(``, 5, `left`)).to.equal(` `, `left`);
expect(alignString(``, 5, `center`)).to.equal(` `, `center`);
expect(alignString(``, 5, `right`)).to.equal(` `, `right`);
});
});
context(`plain text`, () => {

@@ -48,0 +55,0 @@ context(`alignment`, () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc