Skip to content

Commit 9ea8bad

Browse files
committed
refactor: update implementation and clean-up
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent f4502df commit 9ea8bad

File tree

90 files changed

+5075
-1901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+5075
-1901
lines changed

lib/node_modules/@stdlib/plot/table/unicode/README.md

Lines changed: 455 additions & 115 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/plot/table/unicode/benchmark/benchmark.js

Lines changed: 538 additions & 116 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/plot/table/unicode/benchmark/benchmark.render.js

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var random = require( '@stdlib/random/array/discrete-uniform' );
2525
var pow = require( '@stdlib/math/base/special/pow' );
26-
var Float64Array = require( '@stdlib/array/float64' );
2726
var array = require( '@stdlib/ndarray/array' );
2827
var pkg = require( './../package.json' ).name;
2928
var UnicodeTable = require( './../lib' );
@@ -41,42 +40,19 @@ var UnicodeTable = require( './../lib' );
4140
* @returns {Function} benchmark function
4241
*/
4342
function createBenchmark( rows, columns, table ) {
44-
var headers;
4543
var data;
46-
var i;
4744

48-
data = new Float64Array( rows * columns );
49-
for ( i = 0; i < data.length; i++ ) {
50-
data[ i ] = randu();
51-
}
52-
data = array( data, {
45+
data = random( rows*columns, 0, 100, {
46+
'dtype': 'float64'
47+
});
48+
table.data = array( data, {
5349
'shape': [ rows, columns ]
5450
});
55-
headers = [];
56-
for ( i = 0; i < columns; i++ ) {
57-
headers.push( randu() );
58-
}
59-
table.data = data;
60-
table.headers = headers;
51+
table.headers = random( columns, 0, columns, {
52+
'dtype': 'generic'
53+
});
6154
return benchmark;
6255

63-
/**
64-
* Generates a row of table data.
65-
*
66-
* @private
67-
* @returns {Array<number>} table data
68-
*/
69-
function row() {
70-
var data;
71-
var i;
72-
73-
data = [];
74-
for ( i = 0; i < columns; i++ ) {
75-
data.push( randu() );
76-
}
77-
return data;
78-
}
79-
8056
/**
8157
* Benchmark function.
8258
*
@@ -89,7 +65,7 @@ function createBenchmark( rows, columns, table ) {
8965

9066
b.tic();
9167
for ( i = 0; i < b.iterations; i++ ) {
92-
str = table.push( row() ).render();
68+
str = table.render();
9369
if ( typeof str !== 'string' ) {
9470
b.fail( 'should return a string' );
9571
}

lib/node_modules/@stdlib/plot/table/unicode/docs/repl.txt

Lines changed: 181 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,202 @@
11

2-
{{alias}}( [data,] [headers,] [options] )
2+
{{alias}}( [data,] [options] )
33
Returns a Unicode table instance.
44

55
Parameters
66
----------
7-
data: Object|Array<Object>|Array<Array>|MatrixLike (optional)
7+
data: Object|Array<Object>|Array<Array>|ndarray (optional)
88
Table data.
99

10-
headers: Collection (optional)
11-
Table headers.
12-
1310
options: Object (optional)
1411
Table options.
1512

16-
options.alignment: Array<string>|string (optional)
17-
Datum's cell alignment(s). Default: 'right'.
13+
options.align: Array<string>|string (optional)
14+
Cell alignment(s). Must be one of the following:
15+
16+
- left: left-aligned.
17+
- center: center-aligned.
18+
- right: right-aligned.
19+
20+
Default: 'right'.
1821

1922
options.autoRender: boolean (optional)
20-
Boolean indicating whether to re-render on a 'change' event. Default:
21-
false.
23+
Boolean indicating whether to automatically re-render on a 'change'
24+
event. Default: false.
2225

23-
options.borders: Array<string> (optional)
24-
Border characters. Default: [ '─', '│', '─', '│' ].
26+
options.borderTop: string (optional)
27+
Top table border character(s). Default: '-'.
2528

26-
options.bufferSize: integer|null (optional)
27-
Data buffer size. If provided, data is kept in a first-in first-out
28-
(FIFO) buffer which cannot exceed the buffer size. Default: +infinity.
29+
options.borderRight: string (optional)
30+
Right table border character(s). Default: '|'.
2931

30-
options.cellPaddingLeft: Array<NonNegativeInteger>|NonNegativeInteger
31-
(optional)
32-
Cell's left padding(s). Default: 1.
32+
options.borderBottom: string (optional)
33+
Bottom table border character(s). Default: '-'.
3334

34-
options.cellPaddingRight: Array<NonNegativeInteger>|NonNegativeInteger
35-
(optional)
36-
Cell's right padding(s). Default: 1.
35+
options.borderLeft: string (optional)
36+
Left table border character(s). Default: '|'.
37+
38+
options.borders: Array<string> (optional)
39+
Table border characters in the order [top, right, bottom, left].
40+
Default: [ '─', '│', '─', '│' ].
41+
42+
options.bufferSize: integer|null (optional)
43+
Data buffer size. If specified, data is kept in a first-in first-out
44+
(FIFO) buffer which cannot exceed the specified buffer size. Default:
45+
+infinity.
3746

3847
options.columnSeparator: string (optional)
3948
Column separator character(s). Default: '│'.
4049

50+
options.cornerTopLeft: string (optional)
51+
Top-left table corner grapheme cluster (i.e., visual character).
52+
Default: '┌'.
53+
54+
options.cornerTopRight: string (optional)
55+
Top-right table corner grapheme cluster (i.e., visual character).
56+
Default: '┐'.
57+
58+
options.cornerBottomRight: string (optional)
59+
Bottom-right table corner grapheme cluster (i.e., visual character).
60+
Default: '┘'.
61+
62+
options.cornerBottomLeft: string (optional)
63+
Bottom-left table corner grapheme cluster (i.e., visual character).
64+
Default: '└'.
65+
4166
options.corners: Array<string> (optional)
42-
Corner characters. Default: [ '┌', '┐', '┘', '└' ].
67+
Table corner grapheme clusters (i.e., visual characters) in the order
68+
[top-left, top-right, bottom-right, bottom-left]. Default: [ '┌', '┐',
69+
'┘', '└' ].
70+
71+
options.headers: Array<string> (optional)
72+
Table headers.
4373

4474
options.headerSeparator: string (optional)
4575
Header separator character(s). Default: '─'.
4676

4777
options.horizontalSeparatorMode: string (optional)
48-
Horizontal line separator mode. The following modes are supported:
78+
Horizontal line separator mode. Must be one of the following:
4979

5080
- resume: resume line sequence after a joint.
5181
- interpolate: skip line character at a joint.
5282
- repeat: repeat line sequence after a joint.
5383

54-
Default: `resume`.
84+
Default: 'resume'.
85+
86+
options.jointMiddle: string (optional)
87+
Joint grapheme cluster (i.e., visual character) connecting cells within
88+
the middle of the table. Default: '┼'.
89+
90+
options.jointTop: string (optional)
91+
Joint grapheme cluster (i.e., visual character) connecting cells along
92+
the top of the table. Default: '┬'.
93+
94+
options.jointRight: string (optional)
95+
Joint grapheme cluster (i.e., visual character) connecting cells along
96+
the right side of the table. Default: '┤'.
97+
98+
options.jointBottom: string (optional)
99+
Joint grapheme cluster (i.e., visual character) connecting cells along
100+
the bottom of the table. Default: '┴'.
101+
102+
options.jointLeft: string (optional)
103+
Joint grapheme cluster (i.e., visual character) connecting cells along
104+
the left side of the table. Default: '├'.
55105

56106
options.joints: Array<string> (optional)
57-
Joint characters. Default: [ '┼', '┬', '┤', '┴', '├' ].
107+
Joint grapheme cluster (i.e., visual characters) in the order [middle,
108+
top, right, bottom, left]. Default: [ '┼', '┬', '┤', '┴', '├' ].
109+
110+
options.marginTop: integer (optional)
111+
Margin at the top of the table in units of blank lines. Default: 0.
112+
113+
options.marginRight: integer (optional)
114+
Margin to the right of the table in units of whitespace. Default: 0.
115+
116+
options.marginBottom: integer (optional)
117+
Margin at the bottom of the table in units of blank lines. Default: 0.
58118

59-
options.marginX: NonNegativeInteger (optional)
60-
Horizontal output margin. Default: 0.
119+
options.marginLeft: integer (optional)
120+
Margin to the left of the table in units of whitespace. Default: 0.
61121

62-
options.marginY: NonNegativeInteger (optional)
63-
Vertical output margin. Default: 0.
122+
options.margins: Array<integer> (optional)
123+
Table margins in the order [top, right, bottom, left]. Default:
124+
[ 0, 0, 0, 0 ].
64125

65-
options.maxCellWidth: Array<NonNegativeInteger>|NonNegativeInteger|null
66-
(optional)
67-
Maximum cell width(s). Default: +infinity.
126+
options.maxCellWidth: Array<integer>|integer|null (optional)
127+
Maximum cell width(s) in units of grapheme clusters (i.e., visual
128+
characters). Default: +infinity.
68129

69-
options.maxOutputWidth: NonNegativeInteger|null (optional)
70-
Maximum output width. Default: +infinity.
130+
options.maxWidth: integer|null (optional)
131+
Maximum table width in units of grapheme clusters (i.e., visual
132+
characters). Default: +infinity.
133+
134+
options.paddingLeft: Array<integer>|integer (optional)
135+
Cell left padding(s) in units of whitespace characters. Default: 1.
136+
137+
options.paddingRight: Array<integer>|integer (optional)
138+
Cell right padding(s) in units of whitespace characters. Default: 1.
71139

72140
options.rowSeparator: string (optional)
73141
Row separator character(s). Default: ''.
74142

75143
options.verticalSeparatorMode: string (optional)
76-
Vertical line separator mode. The following modes are supported:
144+
Vertical line separator mode. Must be one of the following:
77145

78146
- resume: resume line sequence after a joint.
79147
- interpolate: skip line character at a joint.
80148
- repeat: repeat line sequence after a joint.
81149

82-
Default: `resume`.
150+
Default: 'resume'.
83151

84152
Returns
85153
-------
86-
table.alignment
87-
Datum's cell alignment(s).
154+
table: Table
155+
Table instance.
156+
157+
table.align
158+
Cell alignment(s).
88159

89160
table.autoRender
90-
Rendering mode. If `true`, an instance renders on each 'change' event;
91-
otherwise, rendering must be triggered manually.
161+
Rendering mode. If `true`, an instance automatically re-renders on each
162+
'change' event; otherwise, rendering must be triggered manually.
163+
164+
table.borderTop
165+
Top table border character(s).
166+
167+
table.borderRight
168+
Right table border character(s).
169+
170+
table.borderBottom
171+
Bottom table border character(s).
172+
173+
table.borderLeft
174+
Left table border character(s).
92175

93176
table.borders
94-
Border characters.
177+
Table border characters in the order [top, right, bottom, left].
95178

96179
table.bufferSize
97180
Data buffer size.
98181

99-
table.cellPaddingLeft
100-
Cell's left Padding.
101-
102-
table.cellPaddingRight
103-
Cell's right Padding.
104-
105182
table.columnSeparator
106183
Column separator character(s).
107184

185+
table.cornerTopLeft
186+
Top-left table corner grapheme cluster (i.e., visual character).
187+
188+
table.cornerTopRight
189+
Top-right table corner grapheme cluster (i.e., visual character).
190+
191+
table.cornerBottomRight
192+
Bottom-right table corner grapheme cluster (i.e., visual character).
193+
194+
table.cornerBottomLeft
195+
Bottom-left table corner grapheme cluster (i.e., visual character).
196+
108197
table.corners
109-
Corner characters.
198+
Corner grapheme clusters (i.e., visual characters) in the order
199+
[top-left, top-right, bottom-right, bottom-left].
110200

111201
table.data
112202
Table data.
@@ -120,20 +210,56 @@
120210
table.horizontalSeparatorMode
121211
Horizontal line separator mode.
122212

213+
table.jointMiddle
214+
Joint grapheme cluster (i.e., visual character) connecting cells within
215+
the middle of the table.
216+
217+
table.jointTop
218+
Joint grapheme cluster (i.e., visual character) connecting cells along
219+
the top of the table.
220+
221+
table.jointRight
222+
Joint grapheme cluster (i.e., visual character) connecting cells along
223+
the right side of the table.
224+
225+
table.jointBottom
226+
Joint grapheme cluster (i.e., visual character) connecting cells along
227+
the bottom of the table.
228+
229+
table.jointLeft
230+
Joint grapheme cluster (i.e., visual character) connecting cells along
231+
the left side of the table.
232+
123233
table.joints
124-
Joint characters.
234+
Joint grapheme clusters (i.e., visual characters) in the order [middle,
235+
top, right, bottom, left].
125236

126-
table.marginX
127-
Horizontal output margin.
237+
table.marginTop
238+
Top table margin.
128239

129-
table.marginY
130-
Vertical output margin.
240+
table.marginRight
241+
Right table margin.
242+
243+
table.marginBottom
244+
Bottom table margin.
245+
246+
table.marginLeft
247+
Left table margin.
248+
249+
table.margins
250+
Table margins in the order [top, right, bottom, left].
131251

132252
table.maxCellWidth
133253
Maximum cell width.
134254

135-
table.maxOutputWidth
136-
Maximum output width.
255+
table.maxWidth
256+
Maximum table width.
257+
258+
table.paddingLeft
259+
Cell left padding.
260+
261+
table.paddingRight
262+
Cell right padding.
137263

138264
table.push( row )
139265
Appends a row to table data.
@@ -151,7 +277,7 @@
151277
--------
152278
> var data = [ [ 45, 33, 'hello' ], [ 32.54, true, null ] ];
153279
> var headers = [ 'col1', 'col2', 'col3' ];
154-
> var table = new {{alias}}( data, headers );
280+
> var table = new {{alias}}( data, { 'headers': headers } );
155281
> table.render()
156282
'...'
157283

0 commit comments

Comments
 (0)