Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. <a name="table"></a>
  2. # Table
  3. > Produces a string that represents array data in a text table.
  4. [![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat-square)](https://travis-ci.org/gajus/table)
  5. [![Coveralls](https://img.shields.io/coveralls/gajus/table.svg?style=flat-square)](https://coveralls.io/github/gajus/table)
  6. [![NPM version](http://img.shields.io/npm/v/table.svg?style=flat-square)](https://www.npmjs.org/package/table)
  7. [![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)
  8. [![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social&label=Follow)](https://twitter.com/kuizinas)
  9. * [Table](#table)
  10. * [Features](#table-features)
  11. * [Install](#table-install)
  12. * [Usage](#table-usage)
  13. * [API](#table-api)
  14. * [table](#table-api-table-1)
  15. * [createStream](#table-api-createstream)
  16. * [getBorderCharacters](#table-api-getbordercharacters)
  17. ![Demo of table displaying a list of missions to the Moon.](./.README/demo.png)
  18. <a name="table-features"></a>
  19. ## Features
  20. * Works with strings containing [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) characters.
  21. * Works with strings containing [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
  22. * Configurable border characters.
  23. * Configurable content alignment per column.
  24. * Configurable content padding per column.
  25. * Configurable column width.
  26. * Text wrapping.
  27. <a name="table-install"></a>
  28. ## Install
  29. ```bash
  30. npm install table
  31. ```
  32. [![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/gajus)
  33. [![Become a Patron](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/gajus)
  34. <a name="table-usage"></a>
  35. ## Usage
  36. ```js
  37. import { table } from 'table';
  38. // Using commonjs?
  39. // const { table } = require('table');
  40. const data = [
  41. ['0A', '0B', '0C'],
  42. ['1A', '1B', '1C'],
  43. ['2A', '2B', '2C']
  44. ];
  45. console.log(table(data));
  46. ```
  47. ```
  48. ╔════╤════╤════╗
  49. ║ 0A │ 0B │ 0C ║
  50. ╟────┼────┼────╢
  51. ║ 1A │ 1B │ 1C ║
  52. ╟────┼────┼────╢
  53. ║ 2A │ 2B │ 2C ║
  54. ╚════╧════╧════╝
  55. ```
  56. <a name="table-api"></a>
  57. ## API
  58. <a name="table-api-table-1"></a>
  59. ### table
  60. Returns the string in the table format
  61. **Parameters:**
  62. - **_data_:** The data to display
  63. - Type: `any[][]`
  64. - Required: `true`
  65. - **_config_:** Table configuration
  66. - Type: `object`
  67. - Required: `false`
  68. <a name="table-api-table-1-config-border"></a>
  69. ##### config.border
  70. Type: `{ [type: string]: string }`\
  71. Default: `honeywell` [template](#getbordercharacters)
  72. Custom borders. The keys are any of:
  73. - `topLeft`, `topRight`, `topBody`,`topJoin`
  74. - `bottomLeft`, `bottomRight`, `bottomBody`, `bottomJoin`
  75. - `joinLeft`, `joinRight`, `joinBody`, `joinJoin`
  76. - `bodyLeft`, `bodyRight`, `bodyJoin`
  77. - `headerJoin`
  78. ```js
  79. const data = [
  80. ['0A', '0B', '0C'],
  81. ['1A', '1B', '1C'],
  82. ['2A', '2B', '2C']
  83. ];
  84. const config = {
  85. border: {
  86. topBody: `─`,
  87. topJoin: `┬`,
  88. topLeft: `┌`,
  89. topRight: `┐`,
  90. bottomBody: `─`,
  91. bottomJoin: `┴`,
  92. bottomLeft: `└`,
  93. bottomRight: `┘`,
  94. bodyLeft: `│`,
  95. bodyRight: `│`,
  96. bodyJoin: `│`,
  97. joinBody: `─`,
  98. joinLeft: `├`,
  99. joinRight: `┤`,
  100. joinJoin: `┼`
  101. }
  102. };
  103. console.log(table(data, config));
  104. ```
  105. ```
  106. ┌────┬────┬────┐
  107. │ 0A │ 0B │ 0C │
  108. ├────┼────┼────┤
  109. │ 1A │ 1B │ 1C │
  110. ├────┼────┼────┤
  111. │ 2A │ 2B │ 2C │
  112. └────┴────┴────┘
  113. ```
  114. <a name="table-api-table-1-config-drawverticalline"></a>
  115. ##### config.drawVerticalLine
  116. Type: `(lineIndex: number, columnCount: number) => boolean`\
  117. Default: `() => true`
  118. It is used to tell whether to draw a vertical line. This callback is called for each vertical border of the table.
  119. If the table has `n` columns, then the `index` parameter is alternatively received all numbers in range `[0, n]` inclusively.
  120. ```js
  121. const data = [
  122. ['0A', '0B', '0C'],
  123. ['1A', '1B', '1C'],
  124. ['2A', '2B', '2C'],
  125. ['3A', '3B', '3C'],
  126. ['4A', '4B', '4C']
  127. ];
  128. const config = {
  129. drawVerticalLine: (lineIndex, columnCount) => {
  130. return lineIndex === 0 || lineIndex === columnCount;
  131. }
  132. };
  133. console.log(table(data, config));
  134. ```
  135. ```
  136. ╔════════════╗
  137. ║ 0A 0B 0C ║
  138. ╟────────────╢
  139. ║ 1A 1B 1C ║
  140. ╟────────────╢
  141. ║ 2A 2B 2C ║
  142. ╟────────────╢
  143. ║ 3A 3B 3C ║
  144. ╟────────────╢
  145. ║ 4A 4B 4C ║
  146. ╚════════════╝
  147. ```
  148. <a name="table-api-table-1-config-drawhorizontalline"></a>
  149. ##### config.drawHorizontalLine
  150. Type: `(lineIndex: number, rowCount: number) => boolean`\
  151. Default: `() => true`
  152. It is used to tell whether to draw a horizontal line. This callback is called for each horizontal border of the table.
  153. If the table has `n` rows, then the `index` parameter is alternatively received all numbers in range `[0, n]` inclusively.
  154. If the table has `n` rows and contains the header, then the range will be `[0, n+1]` inclusively.
  155. ```js
  156. const data = [
  157. ['0A', '0B', '0C'],
  158. ['1A', '1B', '1C'],
  159. ['2A', '2B', '2C'],
  160. ['3A', '3B', '3C'],
  161. ['4A', '4B', '4C']
  162. ];
  163. const config = {
  164. drawHorizontalLine: (lineIndex, rowCount) => {
  165. return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount - 1 || lineIndex === rowCount;
  166. }
  167. };
  168. console.log(table(data, config));
  169. ```
  170. ```
  171. ╔════╤════╤════╗
  172. ║ 0A │ 0B │ 0C ║
  173. ╟────┼────┼────╢
  174. ║ 1A │ 1B │ 1C ║
  175. ║ 2A │ 2B │ 2C ║
  176. ║ 3A │ 3B │ 3C ║
  177. ╟────┼────┼────╢
  178. ║ 4A │ 4B │ 4C ║
  179. ╚════╧════╧════╝
  180. ```
  181. <a name="table-api-table-1-config-singleline"></a>
  182. ##### config.singleLine
  183. Type: `boolean`\
  184. Default: `false`
  185. If `true`, horizontal lines inside the table are not drawn. This option also overrides the `config.drawHorizontalLine` if specified.
  186. ```js
  187. const data = [
  188. ['-rw-r--r--', '1', 'pandorym', 'staff', '1529', 'May 23 11:25', 'LICENSE'],
  189. ['-rw-r--r--', '1', 'pandorym', 'staff', '16327', 'May 23 11:58', 'README.md'],
  190. ['drwxr-xr-x', '76', 'pandorym', 'staff', '2432', 'May 23 12:02', 'dist'],
  191. ['drwxr-xr-x', '634', 'pandorym', 'staff', '20288', 'May 23 11:54', 'node_modules'],
  192. ['-rw-r--r--', '1,', 'pandorym', 'staff', '525688', 'May 23 11:52', 'package-lock.json'],
  193. ['-rw-r--r--@', '1', 'pandorym', 'staff', '2440', 'May 23 11:25', 'package.json'],
  194. ['drwxr-xr-x', '27', 'pandorym', 'staff', '864', 'May 23 11:25', 'src'],
  195. ['drwxr-xr-x', '20', 'pandorym', 'staff', '640', 'May 23 11:25', 'test'],
  196. ];
  197. const config = {
  198. singleLine: true
  199. };
  200. console.log(table(data, config));
  201. ```
  202. ```
  203. ╔═════════════╤═════╤══════════╤═══════╤════════╤══════════════╤═══════════════════╗
  204. ║ -rw-r--r-- │ 1 │ pandorym │ staff │ 1529 │ May 23 11:25 │ LICENSE ║
  205. ║ -rw-r--r-- │ 1 │ pandorym │ staff │ 16327 │ May 23 11:58 │ README.md ║
  206. ║ drwxr-xr-x │ 76 │ pandorym │ staff │ 2432 │ May 23 12:02 │ dist ║
  207. ║ drwxr-xr-x │ 634 │ pandorym │ staff │ 20288 │ May 23 11:54 │ node_modules ║
  208. ║ -rw-r--r-- │ 1, │ pandorym │ staff │ 525688 │ May 23 11:52 │ package-lock.json ║
  209. ║ -rw-r--r--@ │ 1 │ pandorym │ staff │ 2440 │ May 23 11:25 │ package.json ║
  210. ║ drwxr-xr-x │ 27 │ pandorym │ staff │ 864 │ May 23 11:25 │ src ║
  211. ║ drwxr-xr-x │ 20 │ pandorym │ staff │ 640 │ May 23 11:25 │ test ║
  212. ╚═════════════╧═════╧══════════╧═══════╧════════╧══════════════╧═══════════════════╝
  213. ```
  214. <a name="table-api-table-1-config-columns"></a>
  215. ##### config.columns
  216. Type: `Column[] | { [columnIndex: number]: Column }`
  217. Column specific configurations.
  218. <a name="table-api-table-1-config-columns-config-columns-width"></a>
  219. ###### config.columns[*].width
  220. Type: `number`\
  221. Default: the maximum cell widths of the column
  222. Column width (excluding the paddings).
  223. ```js
  224. const data = [
  225. ['0A', '0B', '0C'],
  226. ['1A', '1B', '1C'],
  227. ['2A', '2B', '2C']
  228. ];
  229. const config = {
  230. columns: {
  231. 1: { width: 10 }
  232. }
  233. };
  234. console.log(table(data, config));
  235. ```
  236. ```
  237. ╔════╤════════════╤════╗
  238. ║ 0A │ 0B │ 0C ║
  239. ╟────┼────────────┼────╢
  240. ║ 1A │ 1B │ 1C ║
  241. ╟────┼────────────┼────╢
  242. ║ 2A │ 2B │ 2C ║
  243. ╚════╧════════════╧════╝
  244. ```
  245. <a name="table-api-table-1-config-columns-config-columns-alignment"></a>
  246. ###### config.columns[*].alignment
  247. Type: `'center' | 'justify' | 'left' | 'right'`\
  248. Default: `'left'`
  249. Cell content horizontal alignment
  250. ```js
  251. const data = [
  252. ['0A', '0B', '0C', '0D 0E 0F'],
  253. ['1A', '1B', '1C', '1D 1E 1F'],
  254. ['2A', '2B', '2C', '2D 2E 2F'],
  255. ];
  256. const config = {
  257. columnDefault: {
  258. width: 10,
  259. },
  260. columns: [
  261. { alignment: 'left' },
  262. { alignment: 'center' },
  263. { alignment: 'right' },
  264. { alignment: 'justify' }
  265. ],
  266. };
  267. console.log(table(data, config));
  268. ```
  269. ```
  270. ╔════════════╤════════════╤════════════╤════════════╗
  271. ║ 0A │ 0B │ 0C │ 0D 0E 0F ║
  272. ╟────────────┼────────────┼────────────┼────────────╢
  273. ║ 1A │ 1B │ 1C │ 1D 1E 1F ║
  274. ╟────────────┼────────────┼────────────┼────────────╢
  275. ║ 2A │ 2B │ 2C │ 2D 2E 2F ║
  276. ╚════════════╧════════════╧════════════╧════════════╝
  277. ```
  278. <a name="table-api-table-1-config-columns-config-columns-verticalalignment"></a>
  279. ###### config.columns[*].verticalAlignment
  280. Type: `'top' | 'middle' | 'bottom'`\
  281. Default: `'top'`
  282. Cell content vertical alignment
  283. ```js
  284. const data = [
  285. ['A', 'B', 'C', 'DEF'],
  286. ];
  287. const config = {
  288. columnDefault: {
  289. width: 1,
  290. },
  291. columns: [
  292. { verticalAlignment: 'top' },
  293. { verticalAlignment: 'middle' },
  294. { verticalAlignment: 'bottom' },
  295. ],
  296. };
  297. console.log(table(data, config));
  298. ```
  299. ```
  300. ╔═══╤═══╤═══╤═══╗
  301. ║ A │ │ │ D ║
  302. ║ │ B │ │ E ║
  303. ║ │ │ C │ F ║
  304. ╚═══╧═══╧═══╧═══╝
  305. ```
  306. <a name="table-api-table-1-config-columns-config-columns-paddingleft"></a>
  307. ###### config.columns[*].paddingLeft
  308. Type: `number`\
  309. Default: `1`
  310. The number of whitespaces used to pad the content on the left.
  311. <a name="table-api-table-1-config-columns-config-columns-paddingright"></a>
  312. ###### config.columns[*].paddingRight
  313. Type: `number`\
  314. Default: `1`
  315. The number of whitespaces used to pad the content on the right.
  316. The `paddingLeft` and `paddingRight` options do not count on the column width. So the column has `width = 5`, `paddingLeft = 2` and `paddingRight = 2` will have the total width is `9`.
  317. ```js
  318. const data = [
  319. ['0A', 'AABBCC', '0C'],
  320. ['1A', '1B', '1C'],
  321. ['2A', '2B', '2C']
  322. ];
  323. const config = {
  324. columns: [
  325. {
  326. paddingLeft: 3
  327. },
  328. {
  329. width: 2,
  330. paddingRight: 3
  331. }
  332. ]
  333. };
  334. console.log(table(data, config));
  335. ```
  336. ```
  337. ╔══════╤══════╤════╗
  338. ║ 0A │ AA │ 0C ║
  339. ║ │ BB │ ║
  340. ║ │ CC │ ║
  341. ╟──────┼──────┼────╢
  342. ║ 1A │ 1B │ 1C ║
  343. ╟──────┼──────┼────╢
  344. ║ 2A │ 2B │ 2C ║
  345. ╚══════╧══════╧════╝
  346. ```
  347. <a name="table-api-table-1-config-columns-config-columns-truncate"></a>
  348. ###### config.columns[*].truncate
  349. Type: `number`\
  350. Default: `Infinity`
  351. The number of characters is which the content will be truncated.
  352. To handle a content that overflows the container width, `table` package implements [text wrapping](#config.columns[*].wrapWord). However, sometimes you may want to truncate content that is too long to be displayed in the table.
  353. ```js
  354. const data = [
  355. ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
  356. ];
  357. const config = {
  358. columns: [
  359. {
  360. width: 20,
  361. truncate: 100
  362. }
  363. ]
  364. };
  365. console.log(table(data, config));
  366. ```
  367. ```
  368. ╔══════════════════════╗
  369. ║ Lorem ipsum dolor si ║
  370. ║ t amet, consectetur ║
  371. ║ adipiscing elit. Pha ║
  372. ║ sellus pulvinar nibh ║
  373. ║ sed mauris convall… ║
  374. ╚══════════════════════╝
  375. ```
  376. <a name="table-api-table-1-config-columns-config-columns-wrapword"></a>
  377. ###### config.columns[*].wrapWord
  378. Type: `boolean`\
  379. Default: `false`
  380. The `table` package implements auto text wrapping, i.e., text that has the width greater than the container width will be separated into multiple lines at the nearest space or one of the special characters: `\|/_.,;-`.
  381. When `wrapWord` is `false`:
  382. ```js
  383. const data = [
  384. ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
  385. ];
  386. const config = {
  387. columns: [ { width: 20 } ]
  388. };
  389. console.log(table(data, config));
  390. ```
  391. ```
  392. ╔══════════════════════╗
  393. ║ Lorem ipsum dolor si ║
  394. ║ t amet, consectetur ║
  395. ║ adipiscing elit. Pha ║
  396. ║ sellus pulvinar nibh ║
  397. ║ sed mauris convallis ║
  398. ║ dapibus. Nunc venena ║
  399. ║ tis tempus nulla sit ║
  400. ║ amet viverra. ║
  401. ╚══════════════════════╝
  402. ```
  403. When `wrapWord` is `true`:
  404. ```
  405. ╔══════════════════════╗
  406. ║ Lorem ipsum dolor ║
  407. ║ sit amet, ║
  408. ║ consectetur ║
  409. ║ adipiscing elit. ║
  410. ║ Phasellus pulvinar ║
  411. ║ nibh sed mauris ║
  412. ║ convallis dapibus. ║
  413. ║ Nunc venenatis ║
  414. ║ tempus nulla sit ║
  415. ║ amet viverra. ║
  416. ╚══════════════════════╝
  417. ```
  418. <a name="table-api-table-1-config-columndefault"></a>
  419. ##### config.columnDefault
  420. Type: `Column`\
  421. Default: `{}`
  422. The default configuration for all columns. Column-specific settings will overwrite the default values.
  423. <a name="table-api-table-1-config-header"></a>
  424. ##### config.header
  425. Type: `object`
  426. Header configuration.
  427. The header configuration inherits the most of the column's, except:
  428. - `content` **{string}**: the header content.
  429. - `width:` calculate based on the content width automatically.
  430. - `alignment:` `center` be default.
  431. - `verticalAlignment:` is not supported.
  432. - `config.border.topJoin` will be `config.border.topBody` for prettier.
  433. ```js
  434. const data = [
  435. ['0A', '0B', '0C'],
  436. ['1A', '1B', '1C'],
  437. ['2A', '2B', '2C'],
  438. ];
  439. const config = {
  440. columnDefault: {
  441. width: 10,
  442. },
  443. header: {
  444. alignment: 'center',
  445. content: 'THE HEADER\nThis is the table about something',
  446. },
  447. }
  448. console.log(table(data, config));
  449. ```
  450. ```
  451. ╔══════════════════════════════════════╗
  452. ║ THE HEADER ║
  453. ║ This is the table about something ║
  454. ╟────────────┬────────────┬────────────╢
  455. ║ 0A │ 0B │ 0C ║
  456. ╟────────────┼────────────┼────────────╢
  457. ║ 1A │ 1B │ 1C ║
  458. ╟────────────┼────────────┼────────────╢
  459. ║ 2A │ 2B │ 2C ║
  460. ╚════════════╧════════════╧════════════╝
  461. ```
  462. <a name="table-api-createstream"></a>
  463. ### createStream
  464. `table` package exports `createStream` function used to draw a table and append rows.
  465. **Parameter:**
  466. - _**config:**_ the same as `table`'s, except `config.columnDefault.width` and `config.columnCount` must be provided.
  467. ```js
  468. import { createStream } from 'table';
  469. const config = {
  470. columnDefault: {
  471. width: 50
  472. },
  473. columnCount: 1
  474. };
  475. const stream = createStream(config);
  476. setInterval(() => {
  477. stream.write([new Date()]);
  478. }, 500);
  479. ```
  480. ![Streaming current date.](./.README/api/stream/streaming.gif)
  481. `table` package uses ANSI escape codes to overwrite the output of the last line when a new row is printed.
  482. The underlying implementation is explained in this [Stack Overflow answer](http://stackoverflow.com/a/32938658/368691).
  483. Streaming supports all of the configuration properties and functionality of a static table (such as auto text wrapping, alignment and padding), e.g.
  484. ```js
  485. import { createStream } from 'table';
  486. import _ from 'lodash';
  487. const config = {
  488. columnDefault: {
  489. width: 50
  490. },
  491. columnCount: 3,
  492. columns: [
  493. {
  494. width: 10,
  495. alignment: 'right'
  496. },
  497. { alignment: 'center' },
  498. { width: 10 }
  499. ]
  500. };
  501. const stream = createStream(config);
  502. let i = 0;
  503. setInterval(() => {
  504. let random;
  505. random = _.sample('abcdefghijklmnopqrstuvwxyz', _.random(1, 30)).join('');
  506. stream.write([i++, new Date(), random]);
  507. }, 500);
  508. ```
  509. ![Streaming random data.](./.README/api/stream/streaming-random.gif)
  510. <a name="table-api-getbordercharacters"></a>
  511. ### getBorderCharacters
  512. **Parameter:**
  513. - **_template_**
  514. - Type: `'honeywell' | 'norc' | 'ramac' | 'void'`
  515. - Required: `true`
  516. You can load one of the predefined border templates using `getBorderCharacters` function.
  517. ```js
  518. import { table, getBorderCharacters } from 'table';
  519. const data = [
  520. ['0A', '0B', '0C'],
  521. ['1A', '1B', '1C'],
  522. ['2A', '2B', '2C']
  523. ];
  524. const config = {
  525. border: getBorderCharacters(`name of the template`)
  526. };
  527. console.log(table(data, config));
  528. ```
  529. ```
  530. # honeywell
  531. ╔════╤════╤════╗
  532. ║ 0A │ 0B │ 0C ║
  533. ╟────┼────┼────╢
  534. ║ 1A │ 1B │ 1C ║
  535. ╟────┼────┼────╢
  536. ║ 2A │ 2B │ 2C ║
  537. ╚════╧════╧════╝
  538. # norc
  539. ┌────┬────┬────┐
  540. │ 0A │ 0B │ 0C │
  541. ├────┼────┼────┤
  542. │ 1A │ 1B │ 1C │
  543. ├────┼────┼────┤
  544. │ 2A │ 2B │ 2C │
  545. └────┴────┴────┘
  546. # ramac (ASCII; for use in terminals that do not support Unicode characters)
  547. +----+----+----+
  548. | 0A | 0B | 0C |
  549. |----|----|----|
  550. | 1A | 1B | 1C |
  551. |----|----|----|
  552. | 2A | 2B | 2C |
  553. +----+----+----+
  554. # void (no borders; see "borderless table" section of the documentation)
  555. 0A 0B 0C
  556. 1A 1B 1C
  557. 2A 2B 2C
  558. ```
  559. Raise [an issue](https://github.com/gajus/table/issues) if you'd like to contribute a new border template.
  560. <a name="table-api-getbordercharacters-borderless-table"></a>
  561. #### Borderless Table
  562. Simply using `void` border character template creates a table with a lot of unnecessary spacing.
  563. To create a more pleasant to the eye table, reset the padding and remove the joining rows, e.g.
  564. ```js
  565. const output = table(data, {
  566. border: getBorderCharacters('void'),
  567. columnDefault: {
  568. paddingLeft: 0,
  569. paddingRight: 1
  570. },
  571. drawHorizontalLine: () => false
  572. }
  573. );
  574. console.log(output);
  575. ```
  576. ```
  577. 0A 0B 0C
  578. 1A 1B 1C
  579. 2A 2B 2C
  580. ```