Skip to content

Commit f76f36e

Browse files
committedNov 22, 2016
feat: remove default export in favour of explicit exports
1 parent 5ff42f3 commit f76f36e

16 files changed

+76
-38
lines changed
 

‎.README/usage.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
Table data is described using an array (rows) of array (cells).
44

55
```js
6-
import table from 'table';
6+
import {
7+
table
8+
} from 'table';
9+
10+
// Using commonjs?
11+
// const {table} = require('table');
712

813
let data,
914
output;

‎.README/usage/predefined_border_templates.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
You can load one of the predefined border templates using `getBorderCharacters` function.
44

55
```js
6-
import table, {
6+
import {
7+
table,
78
getBorderCharacters
89
} from 'table';
910

‎.babelrc

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"plugins": [
3-
"add-module-exports"
4-
],
52
"presets": [
63
"es2015-node4"
74
],

‎README.md

+34-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<h1 id="table">Table</h1>
1+
<a name="table"></a>
2+
# Table
23

34
[![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat)](https://travis-ci.org/gajus/table)
45
[![NPM version](http://img.shields.io/npm/v/table.svg?style=flat)](https://www.npmjs.com/package/table)
@@ -22,7 +23,8 @@ Produces a string that represents array data in a text table.
2223

2324
![Demo of table displaying a list of missions to the Moon.](./.README/demo.png)
2425

25-
<h2 id="table-features">Features</h2>
26+
<a name="table-features"></a>
27+
## Features
2628

2729
* Works with strings containing [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) characters.
2830
* Works with strings containing [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
@@ -32,12 +34,18 @@ Produces a string that represents array data in a text table.
3234
* Configurable column width.
3335
* Text wrapping.
3436

35-
<h2 id="table-usage">Usage</h2>
37+
<a name="table-usage"></a>
38+
## Usage
3639

3740
Table data is described using an array (rows) of array (cells).
3841

3942
```js
40-
import table from 'table';
43+
import {
44+
table
45+
} from 'table';
46+
47+
// Using commonjs?
48+
// const {table} = require('table');
4149

4250
let data,
4351
output;
@@ -125,7 +133,8 @@ console.log(output);
125133
```
126134

127135

128-
<h3 id="table-usage-cell-content-alignment">Cell Content Alignment</h3>
136+
<a name="table-usage-cell-content-alignment"></a>
137+
### Cell Content Alignment
129138

130139
`{string} config.columns[{number}].alignment` property controls content horizontal alignment within a cell.
131140

@@ -174,7 +183,8 @@ console.log(output);
174183
╚════════════╧════════════╧════════════╝
175184
```
176185

177-
<h3 id="table-usage-column-width">Column Width</h3>
186+
<a name="table-usage-column-width"></a>
187+
### Column Width
178188

179189
`{number} config.columns[{number}].width` property restricts column width to a fixed width.
180190

@@ -212,7 +222,8 @@ console.log(output);
212222
╚════╧════════════╧════╝
213223
```
214224

215-
<h3 id="table-usage-custom-border">Custom Border</h3>
225+
<a name="table-usage-custom-border"></a>
226+
### Custom Border
216227

217228
`{object} config.border` property describes characters used to draw the table border.
218229

@@ -265,7 +276,8 @@ console.log(output);
265276
└────┴────┴────┘
266277
```
267278

268-
<h3 id="table-usage-draw-horizontal-line">Draw Horizontal Line</h3>
279+
<a name="table-usage-draw-horizontal-line"></a>
280+
### Draw Horizontal Line
269281

270282
`{function} config.drawHorizontalLine` property is a function that is called for every non-content row in the table. The result of the function `{boolean}` determines whether a row is drawn.
271283

@@ -311,7 +323,8 @@ console.log(output);
311323
╚════╧════╧════╝
312324
```
313325

314-
<h3 id="table-usage-padding-cell-content">Padding Cell Content</h3>
326+
<a name="table-usage-padding-cell-content"></a>
327+
### Padding Cell Content
315328

316329
`{number} config.columns[{number}].paddingLeft` and `{number} config.columns[{number}].paddingRight` properties control content padding within a cell. Property value represents a number of whitespaces used to pad the content.
317330

@@ -355,12 +368,14 @@ console.log(output);
355368
╚══════╧══════╧════╝
356369
```
357370

358-
<h3 id="table-usage-predefined-border-templates">Predefined Border Templates</h3>
371+
<a name="table-usage-predefined-border-templates"></a>
372+
### Predefined Border Templates
359373

360374
You can load one of the predefined border templates using `getBorderCharacters` function.
361375

362376
```js
363-
import table, {
377+
import {
378+
table,
364379
getBorderCharacters
365380
} from 'table';
366381

@@ -423,7 +438,8 @@ table(data, config);
423438

424439
Raise [an issue](https://github.com/gajus/table/issues) if you'd like to contribute a new border template.
425440

426-
<h4 id="table-usage-predefined-border-templates-borderless-table">Borderless Table</h4>
441+
<a name="table-usage-predefined-border-templates-borderless-table"></a>
442+
#### Borderless Table
427443

428444
Simply using "void" border character template creates a table with a lot of unnecessary spacing.
429445

@@ -452,7 +468,8 @@ console.log(output);
452468
2A 2B 2C
453469
```
454470

455-
<h3 id="table-usage-streaming">Streaming</h3>
471+
<a name="table-usage-streaming"></a>
472+
### Streaming
456473

457474
`table` package exports `createStream` function used to draw a table and append rows.
458475

@@ -532,7 +549,8 @@ setInterval(() => {
532549
```
533550

534551
![Streaming random data.](./.README/streaming-random.gif)
535-
<h3 id="table-usage-text-truncation">Text Truncation</h3>
552+
<a name="table-usage-text-truncation"></a>
553+
### Text Truncation
536554

537555
To handle a content that overflows the container width, `table` package implements [text wrapping](#table-usage-text-wrapping). However, sometimes you may want to truncate content that is too long to be displayed in the table.
538556

@@ -571,7 +589,8 @@ console.log(output);
571589
╚══════════════════════╝
572590
```
573591

574-
<h3 id="table-usage-text-wrapping">Text Wrapping</h3>
592+
<a name="table-usage-text-wrapping"></a>
593+
### Text Wrapping
575594

576595
`table` package implements auto text wrapping, i.e. text that has width greater than the container width will be separated into multiple lines, e.g.
577596

‎package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"babel": "^6.5.2",
1919
"babel-cli": "^6.14.0",
2020
"babel-core": "^6.14.0",
21-
"babel-plugin-add-module-exports": "^0.2.1",
2221
"babel-plugin-istanbul": "^2.0.3",
2322
"babel-preset-es2015-node4": "^2.1.0",
2423
"babel-register": "^6.14.0",
@@ -65,5 +64,5 @@
6564
"prepublish": "NODE_ENV=production npm run build",
6665
"test": "npm run build && nyc --check-coverage mocha"
6766
},
68-
"version": "3.8.3"
67+
"version": "4.0.0"
6968
}

‎src/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import createStream from './createStream';
33
import getBorderCharacters from './getBorderCharacters';
44

55
export {
6-
createStream,
7-
getBorderCharacters
6+
table,
7+
createStream,
8+
getBorderCharacters
89
};
9-
10-
export default table;

‎test/README/usage/basic.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

‎test/README/usage/cell_content_alignment.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

‎test/README/usage/column_width.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

‎test/README/usage/custom_border.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

‎test/README/usage/draw_horizontal_line.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

‎test/README/usage/moon_mission.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import _ from 'lodash';
22
import chalk from 'chalk';
3-
import table, {
4-
getBorderCharacters
3+
import {
4+
table,
5+
getBorderCharacters
56
} from './../../../src';
67

78
describe('README.md usage/', () => {

‎test/README/usage/padding_cell_content.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

‎test/README/usage/predefined_border_templates.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import _ from 'lodash';
2-
import table, {
3-
getBorderCharacters
2+
import {
3+
table,
4+
getBorderCharacters
45
} from './../../../src';
56
import expectTable from './expectTable';
67

‎test/README/usage/text_truncating.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

‎test/README/usage/text_wrapping.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import table from './../../../src';
1+
import {
2+
table
3+
} from './../../../src';
24
import expectTable from './expectTable';
35

46
describe('README.md usage/', () => {

0 commit comments

Comments
 (0)
Please sign in to comment.