Every new change
This commit is contained in:
24
node_modules/table/LICENSE
generated
vendored
Normal file
24
node_modules/table/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Gajus Kuizinas (http://gajus.com/) nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL ANUARY BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
735
node_modules/table/README.md
generated
vendored
Normal file
735
node_modules/table/README.md
generated
vendored
Normal file
@ -0,0 +1,735 @@
|
||||
<a name="table"></a>
|
||||
# Table
|
||||
|
||||
[](https://gitspo.com/mentions/gajus/table)
|
||||
[](https://travis-ci.org/gajus/table)
|
||||
[](https://coveralls.io/github/gajus/table)
|
||||
[](https://www.npmjs.org/package/table)
|
||||
[](https://github.com/gajus/canonical)
|
||||
[](https://twitter.com/kuizinas)
|
||||
|
||||
* [Table](#table)
|
||||
* [Features](#table-features)
|
||||
* [Install](#table-install)
|
||||
* [Usage](#table-usage)
|
||||
* [Cell Content Alignment](#table-usage-cell-content-alignment)
|
||||
* [Column Width](#table-usage-column-width)
|
||||
* [Custom Border](#table-usage-custom-border)
|
||||
* [Draw Horizontal Line](#table-usage-draw-horizontal-line)
|
||||
* [Single Line Mode](#table-usage-single-line-mode)
|
||||
* [Padding Cell Content](#table-usage-padding-cell-content)
|
||||
* [Predefined Border Templates](#table-usage-predefined-border-templates)
|
||||
* [Streaming](#table-usage-streaming)
|
||||
* [Text Truncation](#table-usage-text-truncation)
|
||||
* [Text Wrapping](#table-usage-text-wrapping)
|
||||
|
||||
|
||||
Produces a string that represents array data in a text table.
|
||||
|
||||

|
||||
|
||||
<a name="table-features"></a>
|
||||
## Features
|
||||
|
||||
* Works with strings containing [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) characters.
|
||||
* Works with strings containing [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
|
||||
* Configurable border characters.
|
||||
* Configurable content alignment per column.
|
||||
* Configurable content padding per column.
|
||||
* Configurable column width.
|
||||
* Text wrapping.
|
||||
|
||||
<a name="table-install"></a>
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install table
|
||||
|
||||
```
|
||||
|
||||
[](https://www.buymeacoffee.com/gajus)
|
||||
[](https://www.patreon.com/gajus)
|
||||
|
||||
<a name="table-usage"></a>
|
||||
## Usage
|
||||
|
||||
Table data is described using an array (rows) of array (cells).
|
||||
|
||||
```js
|
||||
import {
|
||||
table
|
||||
} from 'table';
|
||||
|
||||
// Using commonjs?
|
||||
// const {table} = require('table');
|
||||
|
||||
let data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
/**
|
||||
* @typedef {string} table~cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {table~cell[]} table~row
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~columns
|
||||
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
|
||||
* @property {number} width Column width (default: auto).
|
||||
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
|
||||
* @property {number} paddingLeft Cell content padding width left (default: 1).
|
||||
* @property {number} paddingRight Cell content padding width right (default: 1).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to dynamically tell table whether to draw a line separating rows or not.
|
||||
* The default behavior is to always return true.
|
||||
*
|
||||
* @typedef {function} drawHorizontalLine
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~config
|
||||
* @property {table~border} border
|
||||
* @property {table~columns[]} columns Column specific configuration.
|
||||
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
||||
* @property {table~drawHorizontalLine} drawHorizontalLine
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates a text table.
|
||||
*
|
||||
* @param {table~row[]} rows
|
||||
* @param {table~config} config
|
||||
* @return {String}
|
||||
*/
|
||||
output = table(data);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════╧════╝
|
||||
|
||||
```
|
||||
|
||||
|
||||
<a name="table-usage-cell-content-alignment"></a>
|
||||
### Cell Content Alignment
|
||||
|
||||
`{string} config.columns[{number}].alignment` property controls content horizontal alignment within a cell.
|
||||
|
||||
Valid values are: "left", "right" and "center".
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
alignment: 'left',
|
||||
width: 10
|
||||
},
|
||||
1: {
|
||||
alignment: 'center',
|
||||
width: 10
|
||||
},
|
||||
2: {
|
||||
alignment: 'right',
|
||||
width: 10
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔════════════╤════════════╤════════════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────────────┼────────────┼────────────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────────────┼────────────┼────────────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════════════╧════════════╧════════════╝
|
||||
```
|
||||
|
||||
<a name="table-usage-column-width"></a>
|
||||
### Column Width
|
||||
|
||||
`{number} config.columns[{number}].width` property restricts column width to a fixed width.
|
||||
|
||||
```js
|
||||
let data,
|
||||
output,
|
||||
options;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
options = {
|
||||
columns: {
|
||||
1: {
|
||||
width: 10
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, options);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════════════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────────────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────────────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════════════╧════╝
|
||||
```
|
||||
|
||||
<a name="table-usage-custom-border"></a>
|
||||
### Custom Border
|
||||
|
||||
`{object} config.border` property describes characters used to draw the table border.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
border: {
|
||||
topBody: `─`,
|
||||
topJoin: `┬`,
|
||||
topLeft: `┌`,
|
||||
topRight: `┐`,
|
||||
|
||||
bottomBody: `─`,
|
||||
bottomJoin: `┴`,
|
||||
bottomLeft: `└`,
|
||||
bottomRight: `┘`,
|
||||
|
||||
bodyLeft: `│`,
|
||||
bodyRight: `│`,
|
||||
bodyJoin: `│`,
|
||||
|
||||
joinBody: `─`,
|
||||
joinLeft: `├`,
|
||||
joinRight: `┤`,
|
||||
joinJoin: `┼`
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
┌────┬────┬────┐
|
||||
│ 0A │ 0B │ 0C │
|
||||
├────┼────┼────┤
|
||||
│ 1A │ 1B │ 1C │
|
||||
├────┼────┼────┤
|
||||
│ 2A │ 2B │ 2C │
|
||||
└────┴────┴────┘
|
||||
```
|
||||
|
||||
<a name="table-usage-draw-horizontal-line"></a>
|
||||
### Draw Horizontal Line
|
||||
|
||||
`{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.
|
||||
|
||||
```js
|
||||
let data,
|
||||
output,
|
||||
options;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C'],
|
||||
['3A', '3B', '3C'],
|
||||
['4A', '4B', '4C']
|
||||
];
|
||||
|
||||
options = {
|
||||
/**
|
||||
* @typedef {function} drawHorizontalLine
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @return {boolean}
|
||||
*/
|
||||
drawHorizontalLine: (index, size) => {
|
||||
return index === 0 || index === 1 || index === size - 1 || index === size;
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, options);
|
||||
|
||||
console.log(output);
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
║ 2A │ 2B │ 2C ║
|
||||
║ 3A │ 3B │ 3C ║
|
||||
╟────┼────┼────╢
|
||||
║ 4A │ 4B │ 4C ║
|
||||
╚════╧════╧════╝
|
||||
|
||||
```
|
||||
|
||||
<a name="table-usage-single-line-mode"></a>
|
||||
### Single Line Mode
|
||||
|
||||
Horizontal lines inside the table are not drawn.
|
||||
|
||||
```js
|
||||
import {
|
||||
table,
|
||||
getBorderCharacters
|
||||
} from 'table';
|
||||
|
||||
const data = [
|
||||
['-rw-r--r--', '1', 'pandorym', 'staff', '1529', 'May 23 11:25', 'LICENSE'],
|
||||
['-rw-r--r--', '1', 'pandorym', 'staff', '16327', 'May 23 11:58', 'README.md'],
|
||||
['drwxr-xr-x', '76', 'pandorym', 'staff', '2432', 'May 23 12:02', 'dist'],
|
||||
['drwxr-xr-x', '634', 'pandorym', 'staff', '20288', 'May 23 11:54', 'node_modules'],
|
||||
['-rw-r--r--', '1,', 'pandorym', 'staff', '525688', 'May 23 11:52', 'package-lock.json'],
|
||||
['-rw-r--r--@', '1', 'pandorym', 'staff', '2440', 'May 23 11:25', 'package.json'],
|
||||
['drwxr-xr-x', '27', 'pandorym', 'staff', '864', 'May 23 11:25', 'src'],
|
||||
['drwxr-xr-x', '20', 'pandorym', 'staff', '640', 'May 23 11:25', 'test'],
|
||||
];
|
||||
|
||||
const config = {
|
||||
singleLine: true
|
||||
};
|
||||
|
||||
const output = table(data, config);
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔═════════════╤═════╤══════════╤═══════╤════════╤══════════════╤═══════════════════╗
|
||||
║ -rw-r--r-- │ 1 │ pandorym │ staff │ 1529 │ May 23 11:25 │ LICENSE ║
|
||||
║ -rw-r--r-- │ 1 │ pandorym │ staff │ 16327 │ May 23 11:58 │ README.md ║
|
||||
║ drwxr-xr-x │ 76 │ pandorym │ staff │ 2432 │ May 23 12:02 │ dist ║
|
||||
║ drwxr-xr-x │ 634 │ pandorym │ staff │ 20288 │ May 23 11:54 │ node_modules ║
|
||||
║ -rw-r--r-- │ 1, │ pandorym │ staff │ 525688 │ May 23 11:52 │ package-lock.json ║
|
||||
║ -rw-r--r--@ │ 1 │ pandorym │ staff │ 2440 │ May 23 11:25 │ package.json ║
|
||||
║ drwxr-xr-x │ 27 │ pandorym │ staff │ 864 │ May 23 11:25 │ src ║
|
||||
║ drwxr-xr-x │ 20 │ pandorym │ staff │ 640 │ May 23 11:25 │ test ║
|
||||
╚═════════════╧═════╧══════════╧═══════╧════════╧══════════════╧═══════════════════╝
|
||||
```
|
||||
|
||||
<a name="table-usage-padding-cell-content"></a>
|
||||
### Padding Cell Content
|
||||
|
||||
`{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.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['0A', 'AABBCC', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
paddingLeft: 3
|
||||
},
|
||||
1: {
|
||||
width: 2,
|
||||
paddingRight: 3
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════╤══════╤════╗
|
||||
║ 0A │ AA │ 0C ║
|
||||
║ │ BB │ ║
|
||||
║ │ CC │ ║
|
||||
╟──────┼──────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟──────┼──────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚══════╧══════╧════╝
|
||||
```
|
||||
|
||||
<a name="table-usage-predefined-border-templates"></a>
|
||||
### Predefined Border Templates
|
||||
|
||||
You can load one of the predefined border templates using `getBorderCharacters` function.
|
||||
|
||||
```js
|
||||
import {
|
||||
table,
|
||||
getBorderCharacters
|
||||
} from 'table';
|
||||
|
||||
let config,
|
||||
data;
|
||||
|
||||
data = [
|
||||
['0A', '0B', '0C'],
|
||||
['1A', '1B', '1C'],
|
||||
['2A', '2B', '2C']
|
||||
];
|
||||
|
||||
config = {
|
||||
border: getBorderCharacters(`name of the template`)
|
||||
};
|
||||
|
||||
table(data, config);
|
||||
```
|
||||
|
||||
```
|
||||
# honeywell
|
||||
|
||||
╔════╤════╤════╗
|
||||
║ 0A │ 0B │ 0C ║
|
||||
╟────┼────┼────╢
|
||||
║ 1A │ 1B │ 1C ║
|
||||
╟────┼────┼────╢
|
||||
║ 2A │ 2B │ 2C ║
|
||||
╚════╧════╧════╝
|
||||
|
||||
# norc
|
||||
|
||||
┌────┬────┬────┐
|
||||
│ 0A │ 0B │ 0C │
|
||||
├────┼────┼────┤
|
||||
│ 1A │ 1B │ 1C │
|
||||
├────┼────┼────┤
|
||||
│ 2A │ 2B │ 2C │
|
||||
└────┴────┴────┘
|
||||
|
||||
# ramac (ASCII; for use in terminals that do not support Unicode characters)
|
||||
|
||||
+----+----+----+
|
||||
| 0A | 0B | 0C |
|
||||
|----|----|----|
|
||||
| 1A | 1B | 1C |
|
||||
|----|----|----|
|
||||
| 2A | 2B | 2C |
|
||||
+----+----+----+
|
||||
|
||||
# void (no borders; see "bordless table" section of the documentation)
|
||||
|
||||
0A 0B 0C
|
||||
|
||||
1A 1B 1C
|
||||
|
||||
2A 2B 2C
|
||||
|
||||
```
|
||||
|
||||
Raise [an issue](https://github.com/gajus/table/issues) if you'd like to contribute a new border template.
|
||||
|
||||
<a name="table-usage-predefined-border-templates-borderless-table"></a>
|
||||
#### Borderless Table
|
||||
|
||||
Simply using "void" border character template creates a table with a lot of unnecessary spacing.
|
||||
|
||||
To create a more plesant to the eye table, reset the padding and remove the joining rows, e.g.
|
||||
|
||||
```js
|
||||
let output;
|
||||
|
||||
output = table(data, {
|
||||
border: getBorderCharacters(`void`),
|
||||
columnDefault: {
|
||||
paddingLeft: 0,
|
||||
paddingRight: 1
|
||||
},
|
||||
drawHorizontalLine: () => {
|
||||
return false
|
||||
}
|
||||
});
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
0A 0B 0C
|
||||
1A 1B 1C
|
||||
2A 2B 2C
|
||||
```
|
||||
|
||||
<a name="table-usage-streaming"></a>
|
||||
### Streaming
|
||||
|
||||
`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);
|
||||
```
|
||||
|
||||

|
||||
|
||||
`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 (such as auto text wrapping, alignment and padding), 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);
|
||||
```
|
||||
|
||||

|
||||
|
||||
<a name="table-usage-text-truncation"></a>
|
||||
### Text Truncation
|
||||
|
||||
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.
|
||||
|
||||
`{number} config.columns[{number}].truncate` property (default: `Infinity`) truncates the text at the specified length.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
width: 20,
|
||||
truncate: 100
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor si ║
|
||||
║ t amet, consectetur ║
|
||||
║ adipiscing elit. Pha ║
|
||||
║ sellus pulvinar nibh ║
|
||||
║ sed mauris conva... ║
|
||||
╚══════════════════════╝
|
||||
```
|
||||
|
||||
<a name="table-usage-text-wrapping"></a>
|
||||
### Text Wrapping
|
||||
|
||||
`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.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
width: 20
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor si ║
|
||||
║ t amet, consectetur ║
|
||||
║ adipiscing elit. Pha ║
|
||||
║ sellus pulvinar nibh ║
|
||||
║ sed mauris convallis ║
|
||||
║ dapibus. Nunc venena ║
|
||||
║ tis tempus nulla sit ║
|
||||
║ amet viverra. ║
|
||||
╚══════════════════════╝
|
||||
```
|
||||
|
||||
When `wrapWord` is `true` the text is broken at the nearest space or one of the special characters ("-", "_", "\", "/", ".", ",", ";"), e.g.
|
||||
|
||||
```js
|
||||
let config,
|
||||
data,
|
||||
output;
|
||||
|
||||
data = [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']
|
||||
];
|
||||
|
||||
config = {
|
||||
columns: {
|
||||
0: {
|
||||
width: 20,
|
||||
wrapWord: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
output = table(data, config);
|
||||
|
||||
console.log(output);
|
||||
```
|
||||
|
||||
```
|
||||
╔══════════════════════╗
|
||||
║ Lorem ipsum dolor ║
|
||||
║ sit amet, ║
|
||||
║ consectetur ║
|
||||
║ adipiscing elit. ║
|
||||
║ Phasellus pulvinar ║
|
||||
║ nibh sed mauris ║
|
||||
║ convallis dapibus. ║
|
||||
║ Nunc venenatis ║
|
||||
║ tempus nulla sit ║
|
||||
║ amet viverra. ║
|
||||
╚══════════════════════╝
|
||||
|
||||
```
|
||||
|
108
node_modules/table/dist/alignString.js
generated
vendored
Normal file
108
node_modules/table/dist/alignString.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
||||
|
||||
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
||||
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const alignments = ['left', 'right', 'center'];
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
const alignLeft = (subject, width) => {
|
||||
return subject + ' '.repeat(width);
|
||||
};
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
const alignRight = (subject, width) => {
|
||||
return ' '.repeat(width) + subject;
|
||||
};
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
const alignCenter = (subject, width) => {
|
||||
let halfWidth;
|
||||
halfWidth = width / 2;
|
||||
|
||||
if (halfWidth % 2 === 0) {
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);
|
||||
} else {
|
||||
halfWidth = Math.floor(halfWidth);
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Pads a string to the left and/or right to position the subject
|
||||
* text in a desired alignment within a container.
|
||||
*
|
||||
* @param {string} subject
|
||||
* @param {number} containerWidth
|
||||
* @param {string} alignment One of the valid options (left, right, center).
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
const alignString = (subject, containerWidth, alignment) => {
|
||||
if (!(0, _isString2.default)(subject)) {
|
||||
throw new TypeError('Subject parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (!(0, _isNumber2.default)(containerWidth)) {
|
||||
throw new TypeError('Container width parameter value must be a number.');
|
||||
}
|
||||
|
||||
const subjectWidth = (0, _stringWidth.default)(subject);
|
||||
|
||||
if (subjectWidth > containerWidth) {
|
||||
// console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);
|
||||
throw new Error('Subject parameter value width cannot be greater than the container width.');
|
||||
}
|
||||
|
||||
if (!(0, _isString2.default)(alignment)) {
|
||||
throw new TypeError('Alignment parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (!alignments.includes(alignment)) {
|
||||
throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');
|
||||
}
|
||||
|
||||
if (subjectWidth === 0) {
|
||||
return ' '.repeat(containerWidth);
|
||||
}
|
||||
|
||||
const availableWidth = containerWidth - subjectWidth;
|
||||
|
||||
if (alignment === 'left') {
|
||||
return alignLeft(subject, availableWidth);
|
||||
}
|
||||
|
||||
if (alignment === 'right') {
|
||||
return alignRight(subject, availableWidth);
|
||||
}
|
||||
|
||||
return alignCenter(subject, availableWidth);
|
||||
};
|
||||
|
||||
var _default = alignString;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=alignString.js.map
|
96
node_modules/table/dist/alignString.js.flow
generated
vendored
Normal file
96
node_modules/table/dist/alignString.js.flow
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
import _ from 'lodash';
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
const alignments = [
|
||||
'left',
|
||||
'right',
|
||||
'center'
|
||||
];
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignLeft = (subject, width) => {
|
||||
return subject + ' '.repeat(width);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignRight = (subject, width) => {
|
||||
return ' '.repeat(width) + subject;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignCenter = (subject, width) => {
|
||||
let halfWidth;
|
||||
|
||||
halfWidth = width / 2;
|
||||
|
||||
if (halfWidth % 2 === 0) {
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);
|
||||
} else {
|
||||
halfWidth = Math.floor(halfWidth);
|
||||
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pads a string to the left and/or right to position the subject
|
||||
* text in a desired alignment within a container.
|
||||
*
|
||||
* @param {string} subject
|
||||
* @param {number} containerWidth
|
||||
* @param {string} alignment One of the valid options (left, right, center).
|
||||
* @returns {string}
|
||||
*/
|
||||
export default (subject, containerWidth, alignment) => {
|
||||
if (!_.isString(subject)) {
|
||||
throw new TypeError('Subject parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (!_.isNumber(containerWidth)) {
|
||||
throw new TypeError('Container width parameter value must be a number.');
|
||||
}
|
||||
|
||||
const subjectWidth = stringWidth(subject);
|
||||
|
||||
if (subjectWidth > containerWidth) {
|
||||
// console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);
|
||||
|
||||
throw new Error('Subject parameter value width cannot be greater than the container width.');
|
||||
}
|
||||
|
||||
if (!_.isString(alignment)) {
|
||||
throw new TypeError('Alignment parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (!alignments.includes(alignment)) {
|
||||
throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');
|
||||
}
|
||||
|
||||
if (subjectWidth === 0) {
|
||||
return ' '.repeat(containerWidth);
|
||||
}
|
||||
|
||||
const availableWidth = containerWidth - subjectWidth;
|
||||
|
||||
if (alignment === 'left') {
|
||||
return alignLeft(subject, availableWidth);
|
||||
}
|
||||
|
||||
if (alignment === 'right') {
|
||||
return alignRight(subject, availableWidth);
|
||||
}
|
||||
|
||||
return alignCenter(subject, availableWidth);
|
||||
};
|
1
node_modules/table/dist/alignString.js.map
generated
vendored
Normal file
1
node_modules/table/dist/alignString.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/alignString.js"],"names":["alignments","alignLeft","subject","width","repeat","alignRight","alignCenter","halfWidth","Math","floor","containerWidth","alignment","TypeError","subjectWidth","Error","includes","availableWidth"],"mappings":";;;;;;;;;;;AACA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,MADiB,EAEjB,OAFiB,EAGjB,QAHiB,CAAnB;AAMA;;;;;;AAKA,MAAMC,SAAS,GAAG,CAACC,OAAD,EAAUC,KAAV,KAAoB;AACpC,SAAOD,OAAO,GAAG,IAAIE,MAAJ,CAAWD,KAAX,CAAjB;AACD,CAFD;AAIA;;;;;;;AAKA,MAAME,UAAU,GAAG,CAACH,OAAD,EAAUC,KAAV,KAAoB;AACrC,SAAO,IAAIC,MAAJ,CAAWD,KAAX,IAAoBD,OAA3B;AACD,CAFD;AAIA;;;;;;;AAKA,MAAMI,WAAW,GAAG,CAACJ,OAAD,EAAUC,KAAV,KAAoB;AACtC,MAAII,SAAJ;AAEAA,EAAAA,SAAS,GAAGJ,KAAK,GAAG,CAApB;;AAEA,MAAII,SAAS,GAAG,CAAZ,KAAkB,CAAtB,EAAyB;AACvB,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAX,CAAzC;AACD,GAFD,MAEO;AACLA,IAAAA,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWF,SAAX,CAAZ;AAEA,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAS,GAAG,CAAvB,CAAzC;AACD;AACF,CAZD;AAcA;;;;;;;;;;;qBASgBL,O,EAASQ,c,EAAgBC,S,KAAc;AACrD,MAAI,CAAC,wBAAWT,OAAX,CAAL,EAA0B;AACxB,UAAM,IAAIU,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAED,MAAI,CAAC,wBAAWF,cAAX,CAAL,EAAiC;AAC/B,UAAM,IAAIE,SAAJ,CAAc,mDAAd,CAAN;AACD;;AAED,QAAMC,YAAY,GAAG,0BAAYX,OAAZ,CAArB;;AAEA,MAAIW,YAAY,GAAGH,cAAnB,EAAmC;AACjC;AAEA,UAAM,IAAII,KAAJ,CAAU,2EAAV,CAAN;AACD;;AAED,MAAI,CAAC,wBAAWH,SAAX,CAAL,EAA4B;AAC1B,UAAM,IAAIC,SAAJ,CAAc,6CAAd,CAAN;AACD;;AAED,MAAI,CAACZ,UAAU,CAACe,QAAX,CAAoBJ,SAApB,CAAL,EAAqC;AACnC,UAAM,IAAIG,KAAJ,CAAU,4FAAV,CAAN;AACD;;AAED,MAAID,YAAY,KAAK,CAArB,EAAwB;AACtB,WAAO,IAAIT,MAAJ,CAAWM,cAAX,CAAP;AACD;;AAED,QAAMM,cAAc,GAAGN,cAAc,GAAGG,YAAxC;;AAEA,MAAIF,SAAS,KAAK,MAAlB,EAA0B;AACxB,WAAOV,SAAS,CAACC,OAAD,EAAUc,cAAV,CAAhB;AACD;;AAED,MAAIL,SAAS,KAAK,OAAlB,EAA2B;AACzB,WAAON,UAAU,CAACH,OAAD,EAAUc,cAAV,CAAjB;AACD;;AAED,SAAOV,WAAW,CAACJ,OAAD,EAAUc,cAAV,CAAlB;AACD,C","sourcesContent":["import _ from 'lodash';\nimport stringWidth from 'string-width';\n\nconst alignments = [\n 'left',\n 'right',\n 'center'\n];\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignLeft = (subject, width) => {\n return subject + ' '.repeat(width);\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignRight = (subject, width) => {\n return ' '.repeat(width) + subject;\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignCenter = (subject, width) => {\n let halfWidth;\n\n halfWidth = width / 2;\n\n if (halfWidth % 2 === 0) {\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);\n } else {\n halfWidth = Math.floor(halfWidth);\n\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);\n }\n};\n\n/**\n * Pads a string to the left and/or right to position the subject\n * text in a desired alignment within a container.\n *\n * @param {string} subject\n * @param {number} containerWidth\n * @param {string} alignment One of the valid options (left, right, center).\n * @returns {string}\n */\nexport default (subject, containerWidth, alignment) => {\n if (!_.isString(subject)) {\n throw new TypeError('Subject parameter value must be a string.');\n }\n\n if (!_.isNumber(containerWidth)) {\n throw new TypeError('Container width parameter value must be a number.');\n }\n\n const subjectWidth = stringWidth(subject);\n\n if (subjectWidth > containerWidth) {\n // console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);\n\n throw new Error('Subject parameter value width cannot be greater than the container width.');\n }\n\n if (!_.isString(alignment)) {\n throw new TypeError('Alignment parameter value must be a string.');\n }\n\n if (!alignments.includes(alignment)) {\n throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');\n }\n\n if (subjectWidth === 0) {\n return ' '.repeat(containerWidth);\n }\n\n const availableWidth = containerWidth - subjectWidth;\n\n if (alignment === 'left') {\n return alignLeft(subject, availableWidth);\n }\n\n if (alignment === 'right') {\n return alignRight(subject, availableWidth);\n }\n\n return alignCenter(subject, availableWidth);\n};\n"],"file":"alignString.js"}
|
35
node_modules/table/dist/alignTableData.js
generated
vendored
Normal file
35
node_modules/table/dist/alignTableData.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
var _alignString = _interopRequireDefault(require("./alignString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
const alignTableData = (rows, config) => {
|
||||
return rows.map(cells => {
|
||||
return cells.map((value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
|
||||
if ((0, _stringWidth.default)(value) === column.width) {
|
||||
return value;
|
||||
} else {
|
||||
return (0, _alignString.default)(value, column.width, column.alignment);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var _default = alignTableData;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=alignTableData.js.map
|
21
node_modules/table/dist/alignTableData.js.flow
generated
vendored
Normal file
21
node_modules/table/dist/alignTableData.js.flow
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import stringWidth from 'string-width';
|
||||
import alignString from './alignString';
|
||||
|
||||
/**
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
export default (rows, config) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map((value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
|
||||
if (stringWidth(value) === column.width) {
|
||||
return value;
|
||||
} else {
|
||||
return alignString(value, column.width, column.alignment);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
1
node_modules/table/dist/alignTableData.js.map
generated
vendored
Normal file
1
node_modules/table/dist/alignTableData.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/alignTableData.js"],"names":["rows","config","map","cells","value","index1","column","columns","width","alignment"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;wBAKgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,KAAD,EAAQC,MAAR,KAAmB;AAClC,YAAMC,MAAM,GAAGL,MAAM,CAACM,OAAP,CAAeF,MAAf,CAAf;;AAEA,UAAI,0BAAYD,KAAZ,MAAuBE,MAAM,CAACE,KAAlC,EAAyC;AACvC,eAAOJ,KAAP;AACD,OAFD,MAEO;AACL,eAAO,0BAAYA,KAAZ,EAAmBE,MAAM,CAACE,KAA1B,EAAiCF,MAAM,CAACG,SAAxC,CAAP;AACD;AACF,KARM,CAAP;AASD,GAVM,CAAP;AAWD,C","sourcesContent":["import stringWidth from 'string-width';\nimport alignString from './alignString';\n\n/**\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((value, index1) => {\n const column = config.columns[index1];\n\n if (stringWidth(value) === column.width) {\n return value;\n } else {\n return alignString(value, column.width, column.alignment);\n }\n });\n });\n};\n"],"file":"alignTableData.js"}
|
38
node_modules/table/dist/calculateCellHeight.js
generated
vendored
Normal file
38
node_modules/table/dist/calculateCellHeight.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
||||
|
||||
var _wrapCell = _interopRequireDefault(require("./wrapCell"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} columnWidth
|
||||
* @param {boolean} useWrapWord
|
||||
* @returns {number}
|
||||
*/
|
||||
const calculateCellHeight = (value, columnWidth, useWrapWord = false) => {
|
||||
if (!(0, _isString2.default)(value)) {
|
||||
throw new TypeError('Value must be a string.');
|
||||
}
|
||||
|
||||
if (!Number.isInteger(columnWidth)) {
|
||||
throw new TypeError('Column width must be an integer.');
|
||||
}
|
||||
|
||||
if (columnWidth < 1) {
|
||||
throw new Error('Column width must be greater than 0.');
|
||||
}
|
||||
|
||||
return (0, _wrapCell.default)(value, columnWidth, useWrapWord).length;
|
||||
};
|
||||
|
||||
var _default = calculateCellHeight;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateCellHeight.js.map
|
24
node_modules/table/dist/calculateCellHeight.js.flow
generated
vendored
Normal file
24
node_modules/table/dist/calculateCellHeight.js.flow
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import _ from 'lodash';
|
||||
import wrapCell from './wrapCell';
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} columnWidth
|
||||
* @param {boolean} useWrapWord
|
||||
* @returns {number}
|
||||
*/
|
||||
export default (value, columnWidth, useWrapWord = false) => {
|
||||
if (!_.isString(value)) {
|
||||
throw new TypeError('Value must be a string.');
|
||||
}
|
||||
|
||||
if (!Number.isInteger(columnWidth)) {
|
||||
throw new TypeError('Column width must be an integer.');
|
||||
}
|
||||
|
||||
if (columnWidth < 1) {
|
||||
throw new Error('Column width must be greater than 0.');
|
||||
}
|
||||
|
||||
return wrapCell(value, columnWidth, useWrapWord).length;
|
||||
};
|
1
node_modules/table/dist/calculateCellHeight.js.map
generated
vendored
Normal file
1
node_modules/table/dist/calculateCellHeight.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateCellHeight.js"],"names":["value","columnWidth","useWrapWord","TypeError","Number","isInteger","Error","length"],"mappings":";;;;;;;;;AACA;;;;AAEA;;;;;;6BAMgBA,K,EAAOC,W,EAAaC,WAAW,GAAG,K,KAAU;AAC1D,MAAI,CAAC,wBAAWF,KAAX,CAAL,EAAwB;AACtB,UAAM,IAAIG,SAAJ,CAAc,yBAAd,CAAN;AACD;;AAED,MAAI,CAACC,MAAM,CAACC,SAAP,CAAiBJ,WAAjB,CAAL,EAAoC;AAClC,UAAM,IAAIE,SAAJ,CAAc,kCAAd,CAAN;AACD;;AAED,MAAIF,WAAW,GAAG,CAAlB,EAAqB;AACnB,UAAM,IAAIK,KAAJ,CAAU,sCAAV,CAAN;AACD;;AAED,SAAO,uBAASN,KAAT,EAAgBC,WAAhB,EAA6BC,WAA7B,EAA0CK,MAAjD;AACD,C","sourcesContent":["import _ from 'lodash';\nimport wrapCell from './wrapCell';\n\n/**\n * @param {string} value\n * @param {number} columnWidth\n * @param {boolean} useWrapWord\n * @returns {number}\n */\nexport default (value, columnWidth, useWrapWord = false) => {\n if (!_.isString(value)) {\n throw new TypeError('Value must be a string.');\n }\n\n if (!Number.isInteger(columnWidth)) {\n throw new TypeError('Column width must be an integer.');\n }\n\n if (columnWidth < 1) {\n throw new Error('Column width must be greater than 0.');\n }\n\n return wrapCell(value, columnWidth, useWrapWord).length;\n};\n"],"file":"calculateCellHeight.js"}
|
28
node_modules/table/dist/calculateCellWidthIndex.js
generated
vendored
Normal file
28
node_modules/table/dist/calculateCellWidthIndex.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Calculates width of each cell contents.
|
||||
*
|
||||
* @param {string[]} cells
|
||||
* @returns {number[]}
|
||||
*/
|
||||
const calculateCellWidthIndex = cells => {
|
||||
return cells.map(value => {
|
||||
return Math.max(...value.split('\n').map(line => {
|
||||
return (0, _stringWidth.default)(line);
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
var _default = calculateCellWidthIndex;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateCellWidthIndex.js.map
|
17
node_modules/table/dist/calculateCellWidthIndex.js.flow
generated
vendored
Normal file
17
node_modules/table/dist/calculateCellWidthIndex.js.flow
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
/**
|
||||
* Calculates width of each cell contents.
|
||||
*
|
||||
* @param {string[]} cells
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export default (cells) => {
|
||||
return cells.map((value) => {
|
||||
return Math.max(
|
||||
...value.split('\n').map((line) => {
|
||||
return stringWidth(line);
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
1
node_modules/table/dist/calculateCellWidthIndex.js.map
generated
vendored
Normal file
1
node_modules/table/dist/calculateCellWidthIndex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateCellWidthIndex.js"],"names":["cells","map","value","Math","max","split","line"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;gCAMgBA,K,IAAU;AACxB,SAAOA,KAAK,CAACC,GAAN,CAAWC,KAAD,IAAW;AAC1B,WAAOC,IAAI,CAACC,GAAL,CACL,GAAGF,KAAK,CAACG,KAAN,CAAY,IAAZ,EAAkBJ,GAAlB,CAAuBK,IAAD,IAAU;AACjC,aAAO,0BAAYA,IAAZ,CAAP;AACD,KAFE,CADE,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["import stringWidth from 'string-width';\n\n/**\n * Calculates width of each cell contents.\n *\n * @param {string[]} cells\n * @returns {number[]}\n */\nexport default (cells) => {\n return cells.map((value) => {\n return Math.max(\n ...value.split('\\n').map((line) => {\n return stringWidth(line);\n })\n );\n });\n};\n"],"file":"calculateCellWidthIndex.js"}
|
37
node_modules/table/dist/calculateMaximumColumnWidthIndex.js
generated
vendored
Normal file
37
node_modules/table/dist/calculateMaximumColumnWidthIndex.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (width) in every column.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @returns {number[]}
|
||||
*/
|
||||
const calculateMaximumColumnWidthIndex = rows => {
|
||||
if (!rows[0]) {
|
||||
throw new Error('Dataset must have at least one row.');
|
||||
}
|
||||
|
||||
const columns = new Array(rows[0].length).fill(0);
|
||||
rows.forEach(row => {
|
||||
const columnWidthIndex = (0, _calculateCellWidthIndex.default)(row);
|
||||
columnWidthIndex.forEach((valueWidth, index0) => {
|
||||
if (columns[index0] < valueWidth) {
|
||||
columns[index0] = valueWidth;
|
||||
}
|
||||
});
|
||||
});
|
||||
return columns;
|
||||
};
|
||||
|
||||
var _default = calculateMaximumColumnWidthIndex;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateMaximumColumnWidthIndex.js.map
|
27
node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow
generated
vendored
Normal file
27
node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import calculateCellWidthIndex from './calculateCellWidthIndex';
|
||||
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (width) in every column.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export default (rows) => {
|
||||
if (!rows[0]) {
|
||||
throw new Error('Dataset must have at least one row.');
|
||||
}
|
||||
|
||||
const columns = new Array(rows[0].length).fill(0);
|
||||
|
||||
rows.forEach((row) => {
|
||||
const columnWidthIndex = calculateCellWidthIndex(row);
|
||||
|
||||
columnWidthIndex.forEach((valueWidth, index0) => {
|
||||
if (columns[index0] < valueWidth) {
|
||||
columns[index0] = valueWidth;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
1
node_modules/table/dist/calculateMaximumColumnWidthIndex.js.map
generated
vendored
Normal file
1
node_modules/table/dist/calculateMaximumColumnWidthIndex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateMaximumColumnWidthIndex.js"],"names":["rows","Error","columns","Array","length","fill","forEach","row","columnWidthIndex","valueWidth","index0"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;yCAMgBA,I,IAAS;AACvB,MAAI,CAACA,IAAI,CAAC,CAAD,CAAT,EAAc;AACZ,UAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;AACD;;AAED,QAAMC,OAAO,GAAG,IAAIC,KAAJ,CAAUH,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAlB,EAA0BC,IAA1B,CAA+B,CAA/B,CAAhB;AAEAL,EAAAA,IAAI,CAACM,OAAL,CAAcC,GAAD,IAAS;AACpB,UAAMC,gBAAgB,GAAG,sCAAwBD,GAAxB,CAAzB;AAEAC,IAAAA,gBAAgB,CAACF,OAAjB,CAAyB,CAACG,UAAD,EAAaC,MAAb,KAAwB;AAC/C,UAAIR,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAtB,EAAkC;AAChCP,QAAAA,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAlB;AACD;AACF,KAJD;AAKD,GARD;AAUA,SAAOP,OAAP;AACD,C","sourcesContent":["import calculateCellWidthIndex from './calculateCellWidthIndex';\n\n/**\n * Produces an array of values that describe the largest value length (width) in every column.\n *\n * @param {Array[]} rows\n * @returns {number[]}\n */\nexport default (rows) => {\n if (!rows[0]) {\n throw new Error('Dataset must have at least one row.');\n }\n\n const columns = new Array(rows[0].length).fill(0);\n\n rows.forEach((row) => {\n const columnWidthIndex = calculateCellWidthIndex(row);\n\n columnWidthIndex.forEach((valueWidth, index0) => {\n if (columns[index0] < valueWidth) {\n columns[index0] = valueWidth;\n }\n });\n });\n\n return columns;\n};\n"],"file":"calculateMaximumColumnWidthIndex.js"}
|
48
node_modules/table/dist/calculateRowHeightIndex.js
generated
vendored
Normal file
48
node_modules/table/dist/calculateRowHeightIndex.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _max2 = _interopRequireDefault(require("lodash/max"));
|
||||
|
||||
var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
|
||||
|
||||
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
||||
|
||||
var _calculateCellHeight = _interopRequireDefault(require("./calculateCellHeight"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Calculates the vertical row span index.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {number[]}
|
||||
*/
|
||||
const calculateRowHeightIndex = (rows, config) => {
|
||||
const tableWidth = rows[0].length;
|
||||
const rowSpanIndex = [];
|
||||
rows.forEach(cells => {
|
||||
const cellHeightIndex = new Array(tableWidth).fill(1);
|
||||
cells.forEach((value, index1) => {
|
||||
if (!(0, _isNumber2.default)(config.columns[index1].width)) {
|
||||
throw new TypeError('column[index].width must be a number.');
|
||||
}
|
||||
|
||||
if (!(0, _isBoolean2.default)(config.columns[index1].wrapWord)) {
|
||||
throw new TypeError('column[index].wrapWord must be a boolean.');
|
||||
}
|
||||
|
||||
cellHeightIndex[index1] = (0, _calculateCellHeight.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
});
|
||||
rowSpanIndex.push((0, _max2.default)(cellHeightIndex));
|
||||
});
|
||||
return rowSpanIndex;
|
||||
};
|
||||
|
||||
var _default = calculateRowHeightIndex;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateRowHeightIndex.js.map
|
35
node_modules/table/dist/calculateRowHeightIndex.js.flow
generated
vendored
Normal file
35
node_modules/table/dist/calculateRowHeightIndex.js.flow
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import _ from 'lodash';
|
||||
import calculateCellHeight from './calculateCellHeight';
|
||||
|
||||
/**
|
||||
* Calculates the vertical row span index.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export default (rows, config) => {
|
||||
const tableWidth = rows[0].length;
|
||||
|
||||
const rowSpanIndex = [];
|
||||
|
||||
rows.forEach((cells) => {
|
||||
const cellHeightIndex = new Array(tableWidth).fill(1);
|
||||
|
||||
cells.forEach((value, index1) => {
|
||||
if (!_.isNumber(config.columns[index1].width)) {
|
||||
throw new TypeError('column[index].width must be a number.');
|
||||
}
|
||||
|
||||
if (!_.isBoolean(config.columns[index1].wrapWord)) {
|
||||
throw new TypeError('column[index].wrapWord must be a boolean.');
|
||||
}
|
||||
|
||||
cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
});
|
||||
|
||||
rowSpanIndex.push(_.max(cellHeightIndex));
|
||||
});
|
||||
|
||||
return rowSpanIndex;
|
||||
};
|
1
node_modules/table/dist/calculateRowHeightIndex.js.map
generated
vendored
Normal file
1
node_modules/table/dist/calculateRowHeightIndex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateRowHeightIndex.js"],"names":["rows","config","tableWidth","length","rowSpanIndex","forEach","cells","cellHeightIndex","Array","fill","value","index1","columns","width","TypeError","wrapWord","push"],"mappings":";;;;;;;;;;;;;AACA;;;;AAEA;;;;;;;iCAOgBA,I,EAAMC,M,KAAW;AAC/B,QAAMC,UAAU,GAAGF,IAAI,CAAC,CAAD,CAAJ,CAAQG,MAA3B;AAEA,QAAMC,YAAY,GAAG,EAArB;AAEAJ,EAAAA,IAAI,CAACK,OAAL,CAAcC,KAAD,IAAW;AACtB,UAAMC,eAAe,GAAG,IAAIC,KAAJ,CAAUN,UAAV,EAAsBO,IAAtB,CAA2B,CAA3B,CAAxB;AAEAH,IAAAA,KAAK,CAACD,OAAN,CAAc,CAACK,KAAD,EAAQC,MAAR,KAAmB;AAC/B,UAAI,CAAC,wBAAWV,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBE,KAAlC,CAAL,EAA+C;AAC7C,cAAM,IAAIC,SAAJ,CAAc,uCAAd,CAAN;AACD;;AAED,UAAI,CAAC,yBAAYb,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBI,QAAnC,CAAL,EAAmD;AACjD,cAAM,IAAID,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAEDP,MAAAA,eAAe,CAACI,MAAD,CAAf,GAA0B,kCAAoBD,KAApB,EAA2BT,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBE,KAAlD,EAAyDZ,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBI,QAAhF,CAA1B;AACD,KAVD;AAYAX,IAAAA,YAAY,CAACY,IAAb,CAAkB,mBAAMT,eAAN,CAAlB;AACD,GAhBD;AAkBA,SAAOH,YAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport calculateCellHeight from './calculateCellHeight';\n\n/**\n * Calculates the vertical row span index.\n *\n * @param {Array[]} rows\n * @param {Object} config\n * @returns {number[]}\n */\nexport default (rows, config) => {\n const tableWidth = rows[0].length;\n\n const rowSpanIndex = [];\n\n rows.forEach((cells) => {\n const cellHeightIndex = new Array(tableWidth).fill(1);\n\n cells.forEach((value, index1) => {\n if (!_.isNumber(config.columns[index1].width)) {\n throw new TypeError('column[index].width must be a number.');\n }\n\n if (!_.isBoolean(config.columns[index1].wrapWord)) {\n throw new TypeError('column[index].wrapWord must be a boolean.');\n }\n\n cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord);\n });\n\n rowSpanIndex.push(_.max(cellHeightIndex));\n });\n\n return rowSpanIndex;\n};\n"],"file":"calculateRowHeightIndex.js"}
|
132
node_modules/table/dist/createStream.js
generated
vendored
Normal file
132
node_modules/table/dist/createStream.js
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _mapValues2 = _interopRequireDefault(require("lodash/mapValues"));
|
||||
|
||||
var _values2 = _interopRequireDefault(require("lodash/values"));
|
||||
|
||||
var _trimEnd2 = _interopRequireDefault(require("lodash/trimEnd"));
|
||||
|
||||
var _makeStreamConfig = _interopRequireDefault(require("./makeStreamConfig"));
|
||||
|
||||
var _drawRow = _interopRequireDefault(require("./drawRow"));
|
||||
|
||||
var _drawBorder = require("./drawBorder");
|
||||
|
||||
var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData"));
|
||||
|
||||
var _truncateTableData = _interopRequireDefault(require("./truncateTableData"));
|
||||
|
||||
var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex"));
|
||||
|
||||
var _alignTableData = _interopRequireDefault(require("./alignTableData"));
|
||||
|
||||
var _padTableData = _interopRequireDefault(require("./padTableData"));
|
||||
|
||||
var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {Array} data
|
||||
* @param {Object} config
|
||||
* @returns {Array}
|
||||
*/
|
||||
const prepareData = (data, config) => {
|
||||
let rows;
|
||||
rows = (0, _stringifyTableData.default)(data);
|
||||
rows = (0, _truncateTableData.default)(data, config);
|
||||
const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config);
|
||||
rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config);
|
||||
rows = (0, _alignTableData.default)(rows, config);
|
||||
rows = (0, _padTableData.default)(rows, config);
|
||||
return rows;
|
||||
};
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
|
||||
const create = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
const body = rows.map(literalRow => {
|
||||
return (0, _drawRow.default)(literalRow, config.border);
|
||||
}).join('');
|
||||
let output;
|
||||
output = '';
|
||||
output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
|
||||
output = (0, _trimEnd2.default)(output);
|
||||
process.stdout.write(output);
|
||||
};
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
|
||||
const append = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
const body = rows.map(literalRow => {
|
||||
return (0, _drawRow.default)(literalRow, config.border);
|
||||
}).join('');
|
||||
let output = '';
|
||||
const bottom = (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
|
||||
|
||||
if (bottom !== '\n') {
|
||||
output = '\r\u001B[K';
|
||||
}
|
||||
|
||||
output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += bottom;
|
||||
output = (0, _trimEnd2.default)(output);
|
||||
process.stdout.write(output);
|
||||
};
|
||||
/**
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
|
||||
const createStream = (userConfig = {}) => {
|
||||
const config = (0, _makeStreamConfig.default)(userConfig); // @todo Use 'Object.values' when Node.js v6 support is dropped.
|
||||
|
||||
const columnWidthIndex = (0, _values2.default)((0, _mapValues2.default)(config.columns, column => {
|
||||
return column.width + column.paddingLeft + column.paddingRight;
|
||||
}));
|
||||
let empty;
|
||||
empty = true;
|
||||
return {
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @returns {undefined}
|
||||
*/
|
||||
write: row => {
|
||||
if (row.length !== config.columnCount) {
|
||||
throw new Error('Row cell count does not match the config.columnCount.');
|
||||
}
|
||||
|
||||
if (empty) {
|
||||
empty = false;
|
||||
return create(row, columnWidthIndex, config);
|
||||
} else {
|
||||
return append(row, columnWidthIndex, config);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var _default = createStream;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=createStream.js.map
|
127
node_modules/table/dist/createStream.js.flow
generated
vendored
Normal file
127
node_modules/table/dist/createStream.js.flow
generated
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
import _ from 'lodash';
|
||||
import makeStreamConfig from './makeStreamConfig';
|
||||
import drawRow from './drawRow';
|
||||
import {
|
||||
drawBorderBottom,
|
||||
drawBorderJoin,
|
||||
drawBorderTop
|
||||
} from './drawBorder';
|
||||
import stringifyTableData from './stringifyTableData';
|
||||
import truncateTableData from './truncateTableData';
|
||||
import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';
|
||||
import alignTableData from './alignTableData';
|
||||
import padTableData from './padTableData';
|
||||
import calculateRowHeightIndex from './calculateRowHeightIndex';
|
||||
|
||||
/**
|
||||
* @param {Array} data
|
||||
* @param {Object} config
|
||||
* @returns {Array}
|
||||
*/
|
||||
const prepareData = (data, config) => {
|
||||
let rows;
|
||||
|
||||
rows = stringifyTableData(data);
|
||||
|
||||
rows = truncateTableData(data, config);
|
||||
|
||||
const rowHeightIndex = calculateRowHeightIndex(rows, config);
|
||||
|
||||
rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);
|
||||
rows = alignTableData(rows, config);
|
||||
rows = padTableData(rows, config);
|
||||
|
||||
return rows;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
const create = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = rows.map((literalRow) => {
|
||||
return drawRow(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output;
|
||||
|
||||
output = '';
|
||||
|
||||
output += drawBorderTop(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += drawBorderBottom(columnWidthIndex, config.border);
|
||||
|
||||
output = _.trimEnd(output);
|
||||
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
const append = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = rows.map((literalRow) => {
|
||||
return drawRow(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output = '';
|
||||
const bottom = drawBorderBottom(columnWidthIndex, config.border);
|
||||
|
||||
if (bottom !== '\n') {
|
||||
output = '\r\u001B[K';
|
||||
}
|
||||
|
||||
output += drawBorderJoin(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += bottom;
|
||||
|
||||
output = _.trimEnd(output);
|
||||
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
export default (userConfig = {}) => {
|
||||
const config = makeStreamConfig(userConfig);
|
||||
|
||||
// @todo Use 'Object.values' when Node.js v6 support is dropped.
|
||||
const columnWidthIndex = _.values(_.mapValues(config.columns, (column) => {
|
||||
return column.width + column.paddingLeft + column.paddingRight;
|
||||
}));
|
||||
|
||||
let empty;
|
||||
|
||||
empty = true;
|
||||
|
||||
return {
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @returns {undefined}
|
||||
*/
|
||||
write: (row) => {
|
||||
if (row.length !== config.columnCount) {
|
||||
throw new Error('Row cell count does not match the config.columnCount.');
|
||||
}
|
||||
|
||||
if (empty) {
|
||||
empty = false;
|
||||
|
||||
return create(row, columnWidthIndex, config);
|
||||
} else {
|
||||
return append(row, columnWidthIndex, config);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
1
node_modules/table/dist/createStream.js.map
generated
vendored
Normal file
1
node_modules/table/dist/createStream.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
110
node_modules/table/dist/drawBorder.js
generated
vendored
Normal file
110
node_modules/table/dist/drawBorder.js
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = void 0;
|
||||
|
||||
/**
|
||||
* @typedef drawBorder~parts
|
||||
* @property {string} left
|
||||
* @property {string} right
|
||||
* @property {string} body
|
||||
* @property {string} join
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorder~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorder = (columnSizeIndex, parts) => {
|
||||
const columns = columnSizeIndex.map(size => {
|
||||
return parts.body.repeat(size);
|
||||
}).join(parts.join);
|
||||
return parts.left + columns + parts.right + '\n';
|
||||
};
|
||||
/**
|
||||
* @typedef drawBorderTop~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderTop~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
exports.drawBorder = drawBorder;
|
||||
|
||||
const drawBorderTop = (columnSizeIndex, parts) => {
|
||||
const border = drawBorder(columnSizeIndex, {
|
||||
body: parts.topBody,
|
||||
join: parts.topJoin,
|
||||
left: parts.topLeft,
|
||||
right: parts.topRight
|
||||
});
|
||||
|
||||
if (border === '\n') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return border;
|
||||
};
|
||||
/**
|
||||
* @typedef drawBorderJoin~parts
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderJoin~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
exports.drawBorderTop = drawBorderTop;
|
||||
|
||||
const drawBorderJoin = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.joinBody,
|
||||
join: parts.joinJoin,
|
||||
left: parts.joinLeft,
|
||||
right: parts.joinRight
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @typedef drawBorderBottom~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderBottom~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
exports.drawBorderJoin = drawBorderJoin;
|
||||
|
||||
const drawBorderBottom = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.bottomBody,
|
||||
join: parts.bottomJoin,
|
||||
left: parts.bottomLeft,
|
||||
right: parts.bottomRight
|
||||
});
|
||||
};
|
||||
|
||||
exports.drawBorderBottom = drawBorderBottom;
|
||||
//# sourceMappingURL=drawBorder.js.map
|
101
node_modules/table/dist/drawBorder.js.flow
generated
vendored
Normal file
101
node_modules/table/dist/drawBorder.js.flow
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
/**
|
||||
* @typedef drawBorder~parts
|
||||
* @property {string} left
|
||||
* @property {string} right
|
||||
* @property {string} body
|
||||
* @property {string} join
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorder~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorder = (columnSizeIndex, parts) => {
|
||||
const columns = columnSizeIndex
|
||||
.map((size) => {
|
||||
return parts.body.repeat(size);
|
||||
})
|
||||
.join(parts.join);
|
||||
|
||||
return parts.left + columns + parts.right + '\n';
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderTop~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderTop~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderTop = (columnSizeIndex, parts) => {
|
||||
const border = drawBorder(columnSizeIndex, {
|
||||
body: parts.topBody,
|
||||
join: parts.topJoin,
|
||||
left: parts.topLeft,
|
||||
right: parts.topRight
|
||||
});
|
||||
|
||||
if (border === '\n') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return border;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderJoin~parts
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderJoin~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderJoin = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.joinBody,
|
||||
join: parts.joinJoin,
|
||||
left: parts.joinLeft,
|
||||
right: parts.joinRight
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderBottom~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderBottom~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderBottom = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.bottomBody,
|
||||
join: parts.bottomJoin,
|
||||
left: parts.bottomLeft,
|
||||
right: parts.bottomRight
|
||||
});
|
||||
};
|
||||
|
||||
export {
|
||||
drawBorder,
|
||||
drawBorderBottom,
|
||||
drawBorderJoin,
|
||||
drawBorderTop
|
||||
};
|
1
node_modules/table/dist/drawBorder.js.map
generated
vendored
Normal file
1
node_modules/table/dist/drawBorder.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/drawBorder.js"],"names":["drawBorder","columnSizeIndex","parts","columns","map","size","body","repeat","join","left","right","drawBorderTop","border","topBody","topJoin","topLeft","topRight","drawBorderJoin","joinBody","joinJoin","joinLeft","joinRight","drawBorderBottom","bottomBody","bottomJoin","bottomLeft","bottomRight"],"mappings":";;;;;;;AAAA;;;;;;;;AAQA;;;;;AAKA,MAAMA,UAAU,GAAG,CAACC,eAAD,EAAkBC,KAAlB,KAA4B;AAC7C,QAAMC,OAAO,GAAGF,eAAe,CAC5BG,GADa,CACRC,IAAD,IAAU;AACb,WAAOH,KAAK,CAACI,IAAN,CAAWC,MAAX,CAAkBF,IAAlB,CAAP;AACD,GAHa,EAIbG,IAJa,CAIRN,KAAK,CAACM,IAJE,CAAhB;AAMA,SAAON,KAAK,CAACO,IAAN,GAAaN,OAAb,GAAuBD,KAAK,CAACQ,KAA7B,GAAqC,IAA5C;AACD,CARD;AAUA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,aAAa,GAAG,CAACV,eAAD,EAAkBC,KAAlB,KAA4B;AAChD,QAAMU,MAAM,GAAGZ,UAAU,CAACC,eAAD,EAAkB;AACzCK,IAAAA,IAAI,EAAEJ,KAAK,CAACW,OAD6B;AAEzCL,IAAAA,IAAI,EAAEN,KAAK,CAACY,OAF6B;AAGzCL,IAAAA,IAAI,EAAEP,KAAK,CAACa,OAH6B;AAIzCL,IAAAA,KAAK,EAAER,KAAK,CAACc;AAJ4B,GAAlB,CAAzB;;AAOA,MAAIJ,MAAM,KAAK,IAAf,EAAqB;AACnB,WAAO,EAAP;AACD;;AAED,SAAOA,MAAP;AACD,CAbD;AAeA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMK,cAAc,GAAG,CAAChB,eAAD,EAAkBC,KAAlB,KAA4B;AACjD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACgB,QADqB;AAEjCV,IAAAA,IAAI,EAAEN,KAAK,CAACiB,QAFqB;AAGjCV,IAAAA,IAAI,EAAEP,KAAK,CAACkB,QAHqB;AAIjCV,IAAAA,KAAK,EAAER,KAAK,CAACmB;AAJoB,GAAlB,CAAjB;AAMD,CAPD;AASA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,gBAAgB,GAAG,CAACrB,eAAD,EAAkBC,KAAlB,KAA4B;AACnD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACqB,UADqB;AAEjCf,IAAAA,IAAI,EAAEN,KAAK,CAACsB,UAFqB;AAGjCf,IAAAA,IAAI,EAAEP,KAAK,CAACuB,UAHqB;AAIjCf,IAAAA,KAAK,EAAER,KAAK,CAACwB;AAJoB,GAAlB,CAAjB;AAMD,CAPD","sourcesContent":["/**\n * @typedef drawBorder~parts\n * @property {string} left\n * @property {string} right\n * @property {string} body\n * @property {string} join\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorder~parts} parts\n * @returns {string}\n */\nconst drawBorder = (columnSizeIndex, parts) => {\n const columns = columnSizeIndex\n .map((size) => {\n return parts.body.repeat(size);\n })\n .join(parts.join);\n\n return parts.left + columns + parts.right + '\\n';\n};\n\n/**\n * @typedef drawBorderTop~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderTop~parts} parts\n * @returns {string}\n */\nconst drawBorderTop = (columnSizeIndex, parts) => {\n const border = drawBorder(columnSizeIndex, {\n body: parts.topBody,\n join: parts.topJoin,\n left: parts.topLeft,\n right: parts.topRight\n });\n\n if (border === '\\n') {\n return '';\n }\n\n return border;\n};\n\n/**\n * @typedef drawBorderJoin~parts\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinBody\n * @property {string} joinJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderJoin~parts} parts\n * @returns {string}\n */\nconst drawBorderJoin = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.joinBody,\n join: parts.joinJoin,\n left: parts.joinLeft,\n right: parts.joinRight\n });\n};\n\n/**\n * @typedef drawBorderBottom~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderBottom~parts} parts\n * @returns {string}\n */\nconst drawBorderBottom = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.bottomBody,\n join: parts.bottomJoin,\n left: parts.bottomLeft,\n right: parts.bottomRight\n });\n};\n\nexport {\n drawBorder,\n drawBorderBottom,\n drawBorderJoin,\n drawBorderTop\n};\n"],"file":"drawBorder.js"}
|
26
node_modules/table/dist/drawRow.js
generated
vendored
Normal file
26
node_modules/table/dist/drawRow.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* @typedef {Object} drawRow~border
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columns
|
||||
* @param {drawRow~border} border
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawRow = (columns, border) => {
|
||||
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
|
||||
};
|
||||
|
||||
var _default = drawRow;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=drawRow.js.map
|
15
node_modules/table/dist/drawRow.js.flow
generated
vendored
Normal file
15
node_modules/table/dist/drawRow.js.flow
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @typedef {Object} drawRow~border
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columns
|
||||
* @param {drawRow~border} border
|
||||
* @returns {string}
|
||||
*/
|
||||
export default (columns, border) => {
|
||||
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
|
||||
};
|
1
node_modules/table/dist/drawRow.js.map
generated
vendored
Normal file
1
node_modules/table/dist/drawRow.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/drawRow.js"],"names":["columns","border","bodyLeft","join","bodyJoin","bodyRight"],"mappings":";;;;;;;AAAA;;;;;;;AAOA;;;;;iBAKgBA,O,EAASC,M,KAAW;AAClC,SAAOA,MAAM,CAACC,QAAP,GAAkBF,OAAO,CAACG,IAAR,CAAaF,MAAM,CAACG,QAApB,CAAlB,GAAkDH,MAAM,CAACI,SAAzD,GAAqE,IAA5E;AACD,C","sourcesContent":["/**\n * @typedef {Object} drawRow~border\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n */\n\n/**\n * @param {number[]} columns\n * @param {drawRow~border} border\n * @returns {string}\n */\nexport default (columns, border) => {\n return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\\n';\n};\n"],"file":"drawRow.js"}
|
59
node_modules/table/dist/drawTable.js
generated
vendored
Normal file
59
node_modules/table/dist/drawTable.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _drawBorder = require("./drawBorder");
|
||||
|
||||
var _drawRow = _interopRequireDefault(require("./drawRow"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {Array} rows
|
||||
* @param {Object} border
|
||||
* @param {Array} columnSizeIndex
|
||||
* @param {Array} rowSpanIndex
|
||||
* @param {Function} drawHorizontalLine
|
||||
* @param {boolean} singleLine
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawTable = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => {
|
||||
let output;
|
||||
let realRowIndex;
|
||||
let rowHeight;
|
||||
const rowCount = rows.length;
|
||||
realRowIndex = 0;
|
||||
output = '';
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
rows.forEach((row, index0) => {
|
||||
output += (0, _drawRow.default)(row, border);
|
||||
|
||||
if (!rowHeight) {
|
||||
rowHeight = rowSpanIndex[realRowIndex];
|
||||
realRowIndex++;
|
||||
}
|
||||
|
||||
rowHeight--;
|
||||
|
||||
if (!singleLine && rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, border);
|
||||
}
|
||||
});
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
var _default = drawTable;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=drawTable.js.map
|
53
node_modules/table/dist/drawTable.js.flow
generated
vendored
Normal file
53
node_modules/table/dist/drawTable.js.flow
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
import {
|
||||
drawBorderTop,
|
||||
drawBorderJoin,
|
||||
drawBorderBottom
|
||||
} from './drawBorder';
|
||||
import drawRow from './drawRow';
|
||||
|
||||
/**
|
||||
* @param {Array} rows
|
||||
* @param {Object} border
|
||||
* @param {Array} columnSizeIndex
|
||||
* @param {Array} rowSpanIndex
|
||||
* @param {Function} drawHorizontalLine
|
||||
* @param {boolean} singleLine
|
||||
* @returns {string}
|
||||
*/
|
||||
export default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => {
|
||||
let output;
|
||||
let realRowIndex;
|
||||
let rowHeight;
|
||||
|
||||
const rowCount = rows.length;
|
||||
|
||||
realRowIndex = 0;
|
||||
|
||||
output = '';
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += drawBorderTop(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
rows.forEach((row, index0) => {
|
||||
output += drawRow(row, border);
|
||||
|
||||
if (!rowHeight) {
|
||||
rowHeight = rowSpanIndex[realRowIndex];
|
||||
|
||||
realRowIndex++;
|
||||
}
|
||||
|
||||
rowHeight--;
|
||||
|
||||
if (!singleLine && rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += drawBorderJoin(columnSizeIndex, border);
|
||||
}
|
||||
});
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += drawBorderBottom(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
1
node_modules/table/dist/drawTable.js.map
generated
vendored
Normal file
1
node_modules/table/dist/drawTable.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/drawTable.js"],"names":["rows","border","columnSizeIndex","rowSpanIndex","drawHorizontalLine","singleLine","output","realRowIndex","rowHeight","rowCount","length","forEach","row","index0"],"mappings":";;;;;;;AAAA;;AAKA;;;;AAEA;;;;;;;;;mBASgBA,I,EAAMC,M,EAAQC,e,EAAiBC,Y,EAAcC,kB,EAAoBC,U,KAAe;AAC9F,MAAIC,MAAJ;AACA,MAAIC,YAAJ;AACA,MAAIC,SAAJ;AAEA,QAAMC,QAAQ,GAAGT,IAAI,CAACU,MAAtB;AAEAH,EAAAA,YAAY,GAAG,CAAf;AAEAD,EAAAA,MAAM,GAAG,EAAT;;AAEA,MAAIF,kBAAkB,CAACG,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,+BAAcJ,eAAd,EAA+BD,MAA/B,CAAV;AACD;;AAEDD,EAAAA,IAAI,CAACW,OAAL,CAAa,CAACC,GAAD,EAAMC,MAAN,KAAiB;AAC5BP,IAAAA,MAAM,IAAI,sBAAQM,GAAR,EAAaX,MAAb,CAAV;;AAEA,QAAI,CAACO,SAAL,EAAgB;AACdA,MAAAA,SAAS,GAAGL,YAAY,CAACI,YAAD,CAAxB;AAEAA,MAAAA,YAAY;AACb;;AAEDC,IAAAA,SAAS;;AAET,QAAI,CAACH,UAAD,IAAeG,SAAS,KAAK,CAA7B,IAAkCK,MAAM,KAAKJ,QAAQ,GAAG,CAAxD,IAA6DL,kBAAkB,CAACG,YAAD,EAAeE,QAAf,CAAnF,EAA6G;AAC3GH,MAAAA,MAAM,IAAI,gCAAeJ,eAAf,EAAgCD,MAAhC,CAAV;AACD;AACF,GAdD;;AAgBA,MAAIG,kBAAkB,CAACG,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,kCAAiBJ,eAAjB,EAAkCD,MAAlC,CAAV;AACD;;AAED,SAAOK,MAAP;AACD,C","sourcesContent":["import {\n drawBorderTop,\n drawBorderJoin,\n drawBorderBottom\n} from './drawBorder';\nimport drawRow from './drawRow';\n\n/**\n * @param {Array} rows\n * @param {Object} border\n * @param {Array} columnSizeIndex\n * @param {Array} rowSpanIndex\n * @param {Function} drawHorizontalLine\n * @param {boolean} singleLine\n * @returns {string}\n */\nexport default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => {\n let output;\n let realRowIndex;\n let rowHeight;\n\n const rowCount = rows.length;\n\n realRowIndex = 0;\n\n output = '';\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderTop(columnSizeIndex, border);\n }\n\n rows.forEach((row, index0) => {\n output += drawRow(row, border);\n\n if (!rowHeight) {\n rowHeight = rowSpanIndex[realRowIndex];\n\n realRowIndex++;\n }\n\n rowHeight--;\n\n if (!singleLine && rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderJoin(columnSizeIndex, border);\n }\n });\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderBottom(columnSizeIndex, border);\n }\n\n return output;\n};\n"],"file":"drawTable.js"}
|
119
node_modules/table/dist/getBorderCharacters.js
generated
vendored
Normal file
119
node_modules/table/dist/getBorderCharacters.js
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
/**
|
||||
* @typedef border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {border}
|
||||
*/
|
||||
const getBorderCharacters = name => {
|
||||
if (name === 'honeywell') {
|
||||
return {
|
||||
topBody: '═',
|
||||
topJoin: '╤',
|
||||
topLeft: '╔',
|
||||
topRight: '╗',
|
||||
bottomBody: '═',
|
||||
bottomJoin: '╧',
|
||||
bottomLeft: '╚',
|
||||
bottomRight: '╝',
|
||||
bodyLeft: '║',
|
||||
bodyRight: '║',
|
||||
bodyJoin: '│',
|
||||
joinBody: '─',
|
||||
joinLeft: '╟',
|
||||
joinRight: '╢',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'norc') {
|
||||
return {
|
||||
topBody: '─',
|
||||
topJoin: '┬',
|
||||
topLeft: '┌',
|
||||
topRight: '┐',
|
||||
bottomBody: '─',
|
||||
bottomJoin: '┴',
|
||||
bottomLeft: '└',
|
||||
bottomRight: '┘',
|
||||
bodyLeft: '│',
|
||||
bodyRight: '│',
|
||||
bodyJoin: '│',
|
||||
joinBody: '─',
|
||||
joinLeft: '├',
|
||||
joinRight: '┤',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'ramac') {
|
||||
return {
|
||||
topBody: '-',
|
||||
topJoin: '+',
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
bottomBody: '-',
|
||||
bottomJoin: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
bodyLeft: '|',
|
||||
bodyRight: '|',
|
||||
bodyJoin: '|',
|
||||
joinBody: '-',
|
||||
joinLeft: '|',
|
||||
joinRight: '|',
|
||||
joinJoin: '|'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'void') {
|
||||
return {
|
||||
topBody: '',
|
||||
topJoin: '',
|
||||
topLeft: '',
|
||||
topRight: '',
|
||||
bottomBody: '',
|
||||
bottomJoin: '',
|
||||
bottomLeft: '',
|
||||
bottomRight: '',
|
||||
bodyLeft: '',
|
||||
bodyRight: '',
|
||||
bodyJoin: '',
|
||||
joinBody: '',
|
||||
joinLeft: '',
|
||||
joinRight: '',
|
||||
joinJoin: ''
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error('Unknown border template "' + name + '".');
|
||||
};
|
||||
|
||||
var _default = getBorderCharacters;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=getBorderCharacters.js.map
|
120
node_modules/table/dist/getBorderCharacters.js.flow
generated
vendored
Normal file
120
node_modules/table/dist/getBorderCharacters.js.flow
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
/**
|
||||
* @typedef border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {border}
|
||||
*/
|
||||
export default (name) => {
|
||||
if (name === 'honeywell') {
|
||||
return {
|
||||
topBody: '═',
|
||||
topJoin: '╤',
|
||||
topLeft: '╔',
|
||||
topRight: '╗',
|
||||
|
||||
bottomBody: '═',
|
||||
bottomJoin: '╧',
|
||||
bottomLeft: '╚',
|
||||
bottomRight: '╝',
|
||||
|
||||
bodyLeft: '║',
|
||||
bodyRight: '║',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '╟',
|
||||
joinRight: '╢',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'norc') {
|
||||
return {
|
||||
topBody: '─',
|
||||
topJoin: '┬',
|
||||
topLeft: '┌',
|
||||
topRight: '┐',
|
||||
|
||||
bottomBody: '─',
|
||||
bottomJoin: '┴',
|
||||
bottomLeft: '└',
|
||||
bottomRight: '┘',
|
||||
|
||||
bodyLeft: '│',
|
||||
bodyRight: '│',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '├',
|
||||
joinRight: '┤',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'ramac') {
|
||||
return {
|
||||
topBody: '-',
|
||||
topJoin: '+',
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
|
||||
bottomBody: '-',
|
||||
bottomJoin: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
|
||||
bodyLeft: '|',
|
||||
bodyRight: '|',
|
||||
bodyJoin: '|',
|
||||
|
||||
joinBody: '-',
|
||||
joinLeft: '|',
|
||||
joinRight: '|',
|
||||
joinJoin: '|'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'void') {
|
||||
return {
|
||||
topBody: '',
|
||||
topJoin: '',
|
||||
topLeft: '',
|
||||
topRight: '',
|
||||
|
||||
bottomBody: '',
|
||||
bottomJoin: '',
|
||||
bottomLeft: '',
|
||||
bottomRight: '',
|
||||
|
||||
bodyLeft: '',
|
||||
bodyRight: '',
|
||||
bodyJoin: '',
|
||||
|
||||
joinBody: '',
|
||||
joinLeft: '',
|
||||
joinRight: '',
|
||||
joinJoin: ''
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error('Unknown border template "' + name + '".');
|
||||
};
|
1
node_modules/table/dist/getBorderCharacters.js.map
generated
vendored
Normal file
1
node_modules/table/dist/getBorderCharacters.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/getBorderCharacters.js"],"names":["name","topBody","topJoin","topLeft","topRight","bottomBody","bottomJoin","bottomLeft","bottomRight","bodyLeft","bodyRight","bodyJoin","joinBody","joinLeft","joinRight","joinJoin","Error"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;;;;;;;;;AAmBA;;;;4BAIgBA,I,IAAS;AACvB,MAAIA,IAAI,KAAK,WAAb,EAA0B;AACxB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,OAAb,EAAsB;AACpB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,EADJ;AAELC,MAAAA,OAAO,EAAE,EAFJ;AAGLC,MAAAA,OAAO,EAAE,EAHJ;AAILC,MAAAA,QAAQ,EAAE,EAJL;AAMLC,MAAAA,UAAU,EAAE,EANP;AAOLC,MAAAA,UAAU,EAAE,EAPP;AAQLC,MAAAA,UAAU,EAAE,EARP;AASLC,MAAAA,WAAW,EAAE,EATR;AAWLC,MAAAA,QAAQ,EAAE,EAXL;AAYLC,MAAAA,SAAS,EAAE,EAZN;AAaLC,MAAAA,QAAQ,EAAE,EAbL;AAeLC,MAAAA,QAAQ,EAAE,EAfL;AAgBLC,MAAAA,QAAQ,EAAE,EAhBL;AAiBLC,MAAAA,SAAS,EAAE,EAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,QAAM,IAAIC,KAAJ,CAAU,8BAA8BhB,IAA9B,GAAqC,IAA/C,CAAN;AACD,C","sourcesContent":["/* eslint-disable sort-keys */\n\n/**\n * @typedef border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * @param {string} name\n * @returns {border}\n */\nexport default (name) => {\n if (name === 'honeywell') {\n return {\n topBody: '═',\n topJoin: '╤',\n topLeft: '╔',\n topRight: '╗',\n\n bottomBody: '═',\n bottomJoin: '╧',\n bottomLeft: '╚',\n bottomRight: '╝',\n\n bodyLeft: '║',\n bodyRight: '║',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '╟',\n joinRight: '╢',\n joinJoin: '┼'\n };\n }\n\n if (name === 'norc') {\n return {\n topBody: '─',\n topJoin: '┬',\n topLeft: '┌',\n topRight: '┐',\n\n bottomBody: '─',\n bottomJoin: '┴',\n bottomLeft: '└',\n bottomRight: '┘',\n\n bodyLeft: '│',\n bodyRight: '│',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '├',\n joinRight: '┤',\n joinJoin: '┼'\n };\n }\n\n if (name === 'ramac') {\n return {\n topBody: '-',\n topJoin: '+',\n topLeft: '+',\n topRight: '+',\n\n bottomBody: '-',\n bottomJoin: '+',\n bottomLeft: '+',\n bottomRight: '+',\n\n bodyLeft: '|',\n bodyRight: '|',\n bodyJoin: '|',\n\n joinBody: '-',\n joinLeft: '|',\n joinRight: '|',\n joinJoin: '|'\n };\n }\n\n if (name === 'void') {\n return {\n topBody: '',\n topJoin: '',\n topLeft: '',\n topRight: '',\n\n bottomBody: '',\n bottomJoin: '',\n bottomLeft: '',\n bottomRight: '',\n\n bodyLeft: '',\n bodyRight: '',\n bodyJoin: '',\n\n joinBody: '',\n joinLeft: '',\n joinRight: '',\n joinJoin: ''\n };\n }\n\n throw new Error('Unknown border template \"' + name + '\".');\n};\n"],"file":"getBorderCharacters.js"}
|
32
node_modules/table/dist/index.js
generated
vendored
Normal file
32
node_modules/table/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "table", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _table.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createStream", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _createStream.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getBorderCharacters", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _getBorderCharacters.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _table = _interopRequireDefault(require("./table"));
|
||||
|
||||
var _createStream = _interopRequireDefault(require("./createStream"));
|
||||
|
||||
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
//# sourceMappingURL=index.js.map
|
9
node_modules/table/dist/index.js.flow
generated
vendored
Normal file
9
node_modules/table/dist/index.js.flow
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import table from './table';
|
||||
import createStream from './createStream';
|
||||
import getBorderCharacters from './getBorderCharacters';
|
||||
|
||||
export {
|
||||
table,
|
||||
createStream,
|
||||
getBorderCharacters
|
||||
};
|
1
node_modules/table/dist/index.js.map
generated
vendored
Normal file
1
node_modules/table/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["import table from './table';\nimport createStream from './createStream';\nimport getBorderCharacters from './getBorderCharacters';\n\nexport {\n table,\n createStream,\n getBorderCharacters\n};\n"],"file":"index.js"}
|
94
node_modules/table/dist/makeConfig.js
generated
vendored
Normal file
94
node_modules/table/dist/makeConfig.js
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
||||
|
||||
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
||||
|
||||
var _times2 = _interopRequireDefault(require("lodash/times"));
|
||||
|
||||
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
|
||||
|
||||
var _validateConfig = _interopRequireDefault(require("./validateConfig"));
|
||||
|
||||
var _calculateMaximumColumnWidthIndex = _interopRequireDefault(require("./calculateMaximumColumnWidthIndex"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = (border = {}) => {
|
||||
return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border);
|
||||
};
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} columns
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
|
||||
const makeColumns = (rows, columns = {}, columnDefault = {}) => {
|
||||
const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex.default)(rows);
|
||||
(0, _times2.default)(rows[0].length, index => {
|
||||
if ((0, _isUndefined2.default)(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
columns[index] = Object.assign({
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Infinity,
|
||||
width: maximumColumnWidthIndex[index],
|
||||
wrapWord: false
|
||||
}, columnDefault, columns[index]);
|
||||
});
|
||||
return columns;
|
||||
};
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
|
||||
const makeConfig = (rows, userConfig = {}) => {
|
||||
(0, _validateConfig.default)('config.json', userConfig);
|
||||
const config = (0, _cloneDeep2.default)(userConfig);
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(rows, config.columns, config.columnDefault);
|
||||
|
||||
if (!config.drawHorizontalLine) {
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
config.drawHorizontalLine = () => {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
if (config.singleLine === undefined) {
|
||||
config.singleLine = false;
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
var _default = makeConfig;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=makeConfig.js.map
|
76
node_modules/table/dist/makeConfig.js.flow
generated
vendored
Normal file
76
node_modules/table/dist/makeConfig.js.flow
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
import _ from 'lodash';
|
||||
import getBorderCharacters from './getBorderCharacters';
|
||||
import validateConfig from './validateConfig';
|
||||
import calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';
|
||||
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = (border = {}) => {
|
||||
return Object.assign({}, getBorderCharacters('honeywell'), border);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} columns
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeColumns = (rows, columns = {}, columnDefault = {}) => {
|
||||
const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);
|
||||
|
||||
_.times(rows[0].length, (index) => {
|
||||
if (_.isUndefined(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
columns[index] = Object.assign({
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Infinity,
|
||||
width: maximumColumnWidthIndex[index],
|
||||
wrapWord: false
|
||||
}, columnDefault, columns[index]);
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
export default (rows, userConfig = {}) => {
|
||||
validateConfig('config.json', userConfig);
|
||||
|
||||
const config = _.cloneDeep(userConfig);
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(rows, config.columns, config.columnDefault);
|
||||
|
||||
if (!config.drawHorizontalLine) {
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
config.drawHorizontalLine = () => {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
if (config.singleLine === undefined) {
|
||||
config.singleLine = false;
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
1
node_modules/table/dist/makeConfig.js.map
generated
vendored
Normal file
1
node_modules/table/dist/makeConfig.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/makeConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","rows","columns","columnDefault","maximumColumnWidthIndex","length","index","alignment","paddingLeft","paddingRight","truncate","Infinity","width","wrapWord","userConfig","config","drawHorizontalLine","singleLine","undefined"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AACA;;;;AAEA;;;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,MAAM,GAAG,EAAV,KAAiB;AAClC,SAAOC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,kCAAoB,WAApB,CAAlB,EAAoDF,MAApD,CAAP;AACD,CAFD;AAIA;;;;;;;;;;;AASA,MAAMG,WAAW,GAAG,CAACC,IAAD,EAAOC,OAAO,GAAG,EAAjB,EAAqBC,aAAa,GAAG,EAArC,KAA4C;AAC9D,QAAMC,uBAAuB,GAAG,+CAAiCH,IAAjC,CAAhC;AAEA,uBAAQA,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAhB,EAAyBC,KAAD,IAAW;AACjC,QAAI,2BAAcJ,OAAO,CAACI,KAAD,CAArB,CAAJ,EAAmC;AACjCJ,MAAAA,OAAO,CAACI,KAAD,CAAP,GAAiB,EAAjB;AACD;;AAEDJ,IAAAA,OAAO,CAACI,KAAD,CAAP,GAAiBR,MAAM,CAACC,MAAP,CAAc;AAC7BQ,MAAAA,SAAS,EAAE,MADkB;AAE7BC,MAAAA,WAAW,EAAE,CAFgB;AAG7BC,MAAAA,YAAY,EAAE,CAHe;AAI7BC,MAAAA,QAAQ,EAAEC,QAJmB;AAK7BC,MAAAA,KAAK,EAAER,uBAAuB,CAACE,KAAD,CALD;AAM7BO,MAAAA,QAAQ,EAAE;AANmB,KAAd,EAOdV,aAPc,EAOCD,OAAO,CAACI,KAAD,CAPR,CAAjB;AAQD,GAbD;AAeA,SAAOJ,OAAP;AACD,CAnBD;AAqBA;;;;;;;;;;oBAQgBD,I,EAAMa,UAAU,GAAG,E,KAAO;AACxC,+BAAe,aAAf,EAA8BA,UAA9B;AAEA,QAAMC,MAAM,GAAG,yBAAYD,UAAZ,CAAf;AAEAC,EAAAA,MAAM,CAAClB,MAAP,GAAgBD,UAAU,CAACmB,MAAM,CAAClB,MAAR,CAA1B;AACAkB,EAAAA,MAAM,CAACb,OAAP,GAAiBF,WAAW,CAACC,IAAD,EAAOc,MAAM,CAACb,OAAd,EAAuBa,MAAM,CAACZ,aAA9B,CAA5B;;AAEA,MAAI,CAACY,MAAM,CAACC,kBAAZ,EAAgC;AAC9B;;;AAGAD,IAAAA,MAAM,CAACC,kBAAP,GAA4B,MAAM;AAChC,aAAO,IAAP;AACD,KAFD;AAGD;;AAED,MAAID,MAAM,CAACE,UAAP,KAAsBC,SAA1B,EAAqC;AACnCH,IAAAA,MAAM,CAACE,UAAP,GAAoB,KAApB;AACD;;AAED,SAAOF,MAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport getBorderCharacters from './getBorderCharacters';\nimport validateConfig from './validateConfig';\nimport calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';\n\n/**\n * Merges user provided border characters with the default border (\"honeywell\") characters.\n *\n * @param {Object} border\n * @returns {Object}\n */\nconst makeBorder = (border = {}) => {\n return Object.assign({}, getBorderCharacters('honeywell'), border);\n};\n\n/**\n * Creates a configuration for every column using default\n * values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} columns\n * @param {Object} columnDefault\n * @returns {Object}\n */\nconst makeColumns = (rows, columns = {}, columnDefault = {}) => {\n const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);\n\n _.times(rows[0].length, (index) => {\n if (_.isUndefined(columns[index])) {\n columns[index] = {};\n }\n\n columns[index] = Object.assign({\n alignment: 'left',\n paddingLeft: 1,\n paddingRight: 1,\n truncate: Infinity,\n width: maximumColumnWidthIndex[index],\n wrapWord: false\n }, columnDefault, columns[index]);\n });\n\n return columns;\n};\n\n/**\n * Makes a new configuration object out of the userConfig object\n * using default values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} userConfig\n * @returns {Object}\n */\nexport default (rows, userConfig = {}) => {\n validateConfig('config.json', userConfig);\n\n const config = _.cloneDeep(userConfig);\n\n config.border = makeBorder(config.border);\n config.columns = makeColumns(rows, config.columns, config.columnDefault);\n\n if (!config.drawHorizontalLine) {\n /**\n * @returns {boolean}\n */\n config.drawHorizontalLine = () => {\n return true;\n };\n }\n\n if (config.singleLine === undefined) {\n config.singleLine = false;\n }\n\n return config;\n};\n"],"file":"makeConfig.js"}
|
101
node_modules/table/dist/makeStreamConfig.js
generated
vendored
Normal file
101
node_modules/table/dist/makeStreamConfig.js
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
||||
|
||||
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
||||
|
||||
var _times2 = _interopRequireDefault(require("lodash/times"));
|
||||
|
||||
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
|
||||
|
||||
var _validateConfig = _interopRequireDefault(require("./validateConfig"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = (border = {}) => {
|
||||
return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border);
|
||||
};
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*
|
||||
* @param {number} columnCount
|
||||
* @param {Object} columns
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
|
||||
const makeColumns = (columnCount, columns = {}, columnDefault = {}) => {
|
||||
(0, _times2.default)(columnCount, index => {
|
||||
if ((0, _isUndefined2.default)(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
columns[index] = Object.assign({
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Infinity,
|
||||
wrapWord: false
|
||||
}, columnDefault, columns[index]);
|
||||
});
|
||||
return columns;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} columnConfig
|
||||
* @property {string} alignment
|
||||
* @property {number} width
|
||||
* @property {number} truncate
|
||||
* @property {number} paddingLeft
|
||||
* @property {number} paddingRight
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} streamConfig
|
||||
* @property {columnConfig} columnDefault
|
||||
* @property {Object} border
|
||||
* @property {columnConfig[]}
|
||||
* @property {number} columnCount Number of columns in the table (required).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*
|
||||
* @param {streamConfig} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
|
||||
const makeStreamConfig = (userConfig = {}) => {
|
||||
(0, _validateConfig.default)('streamConfig.json', userConfig);
|
||||
const config = (0, _cloneDeep2.default)(userConfig);
|
||||
|
||||
if (!config.columnDefault || !config.columnDefault.width) {
|
||||
throw new Error('Must provide config.columnDefault.width when creating a stream.');
|
||||
}
|
||||
|
||||
if (!config.columnCount) {
|
||||
throw new Error('Must provide config.columnCount.');
|
||||
}
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
|
||||
return config;
|
||||
};
|
||||
|
||||
var _default = makeStreamConfig;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=makeStreamConfig.js.map
|
83
node_modules/table/dist/makeStreamConfig.js.flow
generated
vendored
Normal file
83
node_modules/table/dist/makeStreamConfig.js.flow
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
import _ from 'lodash';
|
||||
import getBorderCharacters from './getBorderCharacters';
|
||||
import validateConfig from './validateConfig';
|
||||
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = (border = {}) => {
|
||||
return Object.assign({}, getBorderCharacters('honeywell'), border);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*
|
||||
* @param {number} columnCount
|
||||
* @param {Object} columns
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeColumns = (columnCount, columns = {}, columnDefault = {}) => {
|
||||
_.times(columnCount, (index) => {
|
||||
if (_.isUndefined(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
columns[index] = Object.assign({
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Infinity,
|
||||
wrapWord: false
|
||||
}, columnDefault, columns[index]);
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} columnConfig
|
||||
* @property {string} alignment
|
||||
* @property {number} width
|
||||
* @property {number} truncate
|
||||
* @property {number} paddingLeft
|
||||
* @property {number} paddingRight
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} streamConfig
|
||||
* @property {columnConfig} columnDefault
|
||||
* @property {Object} border
|
||||
* @property {columnConfig[]}
|
||||
* @property {number} columnCount Number of columns in the table (required).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*
|
||||
* @param {streamConfig} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
export default (userConfig = {}) => {
|
||||
validateConfig('streamConfig.json', userConfig);
|
||||
|
||||
const config = _.cloneDeep(userConfig);
|
||||
|
||||
if (!config.columnDefault || !config.columnDefault.width) {
|
||||
throw new Error('Must provide config.columnDefault.width when creating a stream.');
|
||||
}
|
||||
|
||||
if (!config.columnCount) {
|
||||
throw new Error('Must provide config.columnCount.');
|
||||
}
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
|
||||
|
||||
return config;
|
||||
};
|
1
node_modules/table/dist/makeStreamConfig.js.map
generated
vendored
Normal file
1
node_modules/table/dist/makeStreamConfig.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/makeStreamConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","columnCount","columns","columnDefault","index","alignment","paddingLeft","paddingRight","truncate","Infinity","wrapWord","userConfig","config","width","Error"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;;;AAEA;;;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,MAAM,GAAG,EAAV,KAAiB;AAClC,SAAOC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,kCAAoB,WAApB,CAAlB,EAAoDF,MAApD,CAAP;AACD,CAFD;AAIA;;;;;;;;;;;AASA,MAAMG,WAAW,GAAG,CAACC,WAAD,EAAcC,OAAO,GAAG,EAAxB,EAA4BC,aAAa,GAAG,EAA5C,KAAmD;AACrE,uBAAQF,WAAR,EAAsBG,KAAD,IAAW;AAC9B,QAAI,2BAAcF,OAAO,CAACE,KAAD,CAArB,CAAJ,EAAmC;AACjCF,MAAAA,OAAO,CAACE,KAAD,CAAP,GAAiB,EAAjB;AACD;;AAEDF,IAAAA,OAAO,CAACE,KAAD,CAAP,GAAiBN,MAAM,CAACC,MAAP,CAAc;AAC7BM,MAAAA,SAAS,EAAE,MADkB;AAE7BC,MAAAA,WAAW,EAAE,CAFgB;AAG7BC,MAAAA,YAAY,EAAE,CAHe;AAI7BC,MAAAA,QAAQ,EAAEC,QAJmB;AAK7BC,MAAAA,QAAQ,EAAE;AALmB,KAAd,EAMdP,aANc,EAMCD,OAAO,CAACE,KAAD,CANR,CAAjB;AAOD,GAZD;AAcA,SAAOF,OAAP;AACD,CAhBD;AAkBA;;;;;;;;;AASA;;;;;;;;AAQA;;;;;;;;;0BAOgBS,UAAU,GAAG,E,KAAO;AAClC,+BAAe,mBAAf,EAAoCA,UAApC;AAEA,QAAMC,MAAM,GAAG,yBAAYD,UAAZ,CAAf;;AAEA,MAAI,CAACC,MAAM,CAACT,aAAR,IAAyB,CAACS,MAAM,CAACT,aAAP,CAAqBU,KAAnD,EAA0D;AACxD,UAAM,IAAIC,KAAJ,CAAU,iEAAV,CAAN;AACD;;AAED,MAAI,CAACF,MAAM,CAACX,WAAZ,EAAyB;AACvB,UAAM,IAAIa,KAAJ,CAAU,kCAAV,CAAN;AACD;;AAEDF,EAAAA,MAAM,CAACf,MAAP,GAAgBD,UAAU,CAACgB,MAAM,CAACf,MAAR,CAA1B;AACAe,EAAAA,MAAM,CAACV,OAAP,GAAiBF,WAAW,CAACY,MAAM,CAACX,WAAR,EAAqBW,MAAM,CAACV,OAA5B,EAAqCU,MAAM,CAACT,aAA5C,CAA5B;AAEA,SAAOS,MAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport getBorderCharacters from './getBorderCharacters';\nimport validateConfig from './validateConfig';\n\n/**\n * Merges user provided border characters with the default border (\"honeywell\") characters.\n *\n * @param {Object} border\n * @returns {Object}\n */\nconst makeBorder = (border = {}) => {\n return Object.assign({}, getBorderCharacters('honeywell'), border);\n};\n\n/**\n * Creates a configuration for every column using default\n * values for the missing configuration properties.\n *\n * @param {number} columnCount\n * @param {Object} columns\n * @param {Object} columnDefault\n * @returns {Object}\n */\nconst makeColumns = (columnCount, columns = {}, columnDefault = {}) => {\n _.times(columnCount, (index) => {\n if (_.isUndefined(columns[index])) {\n columns[index] = {};\n }\n\n columns[index] = Object.assign({\n alignment: 'left',\n paddingLeft: 1,\n paddingRight: 1,\n truncate: Infinity,\n wrapWord: false\n }, columnDefault, columns[index]);\n });\n\n return columns;\n};\n\n/**\n * @typedef {Object} columnConfig\n * @property {string} alignment\n * @property {number} width\n * @property {number} truncate\n * @property {number} paddingLeft\n * @property {number} paddingRight\n */\n\n/**\n * @typedef {Object} streamConfig\n * @property {columnConfig} columnDefault\n * @property {Object} border\n * @property {columnConfig[]}\n * @property {number} columnCount Number of columns in the table (required).\n */\n\n/**\n * Makes a new configuration object out of the userConfig object\n * using default values for the missing configuration properties.\n *\n * @param {streamConfig} userConfig\n * @returns {Object}\n */\nexport default (userConfig = {}) => {\n validateConfig('streamConfig.json', userConfig);\n\n const config = _.cloneDeep(userConfig);\n\n if (!config.columnDefault || !config.columnDefault.width) {\n throw new Error('Must provide config.columnDefault.width when creating a stream.');\n }\n\n if (!config.columnCount) {\n throw new Error('Must provide config.columnCount.');\n }\n\n config.border = makeBorder(config.border);\n config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);\n\n return config;\n};\n"],"file":"makeStreamConfig.js"}
|
44
node_modules/table/dist/mapDataUsingRowHeightIndex.js
generated
vendored
Normal file
44
node_modules/table/dist/mapDataUsingRowHeightIndex.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _flatten2 = _interopRequireDefault(require("lodash/flatten"));
|
||||
|
||||
var _times2 = _interopRequireDefault(require("lodash/times"));
|
||||
|
||||
var _wrapCell = _interopRequireDefault(require("./wrapCell"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {Array} unmappedRows
|
||||
* @param {number[]} rowHeightIndex
|
||||
* @param {Object} config
|
||||
* @returns {Array}
|
||||
*/
|
||||
const mapDataUsingRowHeightIndex = (unmappedRows, rowHeightIndex, config) => {
|
||||
const tableWidth = unmappedRows[0].length;
|
||||
const mappedRows = unmappedRows.map((cells, index0) => {
|
||||
const rowHeight = (0, _times2.default)(rowHeightIndex[index0], () => {
|
||||
return new Array(tableWidth).fill('');
|
||||
}); // rowHeight
|
||||
// [{row index within rowSaw; index2}]
|
||||
// [{cell index within a virtual row; index1}]
|
||||
|
||||
cells.forEach((value, index1) => {
|
||||
const cellLines = (0, _wrapCell.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
cellLines.forEach((cellLine, index2) => {
|
||||
rowHeight[index2][index1] = cellLine;
|
||||
});
|
||||
});
|
||||
return rowHeight;
|
||||
});
|
||||
return (0, _flatten2.default)(mappedRows);
|
||||
};
|
||||
|
||||
var _default = mapDataUsingRowHeightIndex;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=mapDataUsingRowHeightIndex.js.map
|
34
node_modules/table/dist/mapDataUsingRowHeightIndex.js.flow
generated
vendored
Normal file
34
node_modules/table/dist/mapDataUsingRowHeightIndex.js.flow
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import _ from 'lodash';
|
||||
import wrapCell from './wrapCell';
|
||||
|
||||
/**
|
||||
* @param {Array} unmappedRows
|
||||
* @param {number[]} rowHeightIndex
|
||||
* @param {Object} config
|
||||
* @returns {Array}
|
||||
*/
|
||||
export default (unmappedRows, rowHeightIndex, config) => {
|
||||
const tableWidth = unmappedRows[0].length;
|
||||
|
||||
const mappedRows = unmappedRows.map((cells, index0) => {
|
||||
const rowHeight = _.times(rowHeightIndex[index0], () => {
|
||||
return new Array(tableWidth).fill('');
|
||||
});
|
||||
|
||||
// rowHeight
|
||||
// [{row index within rowSaw; index2}]
|
||||
// [{cell index within a virtual row; index1}]
|
||||
|
||||
cells.forEach((value, index1) => {
|
||||
const cellLines = wrapCell(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
|
||||
cellLines.forEach((cellLine, index2) => {
|
||||
rowHeight[index2][index1] = cellLine;
|
||||
});
|
||||
});
|
||||
|
||||
return rowHeight;
|
||||
});
|
||||
|
||||
return _.flatten(mappedRows);
|
||||
};
|
1
node_modules/table/dist/mapDataUsingRowHeightIndex.js.map
generated
vendored
Normal file
1
node_modules/table/dist/mapDataUsingRowHeightIndex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/mapDataUsingRowHeightIndex.js"],"names":["unmappedRows","rowHeightIndex","config","tableWidth","length","mappedRows","map","cells","index0","rowHeight","Array","fill","forEach","value","index1","cellLines","columns","width","wrapWord","cellLine","index2"],"mappings":";;;;;;;;;;;AACA;;;;AAEA;;;;;;oCAMgBA,Y,EAAcC,c,EAAgBC,M,KAAW;AACvD,QAAMC,UAAU,GAAGH,YAAY,CAAC,CAAD,CAAZ,CAAgBI,MAAnC;AAEA,QAAMC,UAAU,GAAGL,YAAY,CAACM,GAAb,CAAiB,CAACC,KAAD,EAAQC,MAAR,KAAmB;AACrD,UAAMC,SAAS,GAAG,qBAAQR,cAAc,CAACO,MAAD,CAAtB,EAAgC,MAAM;AACtD,aAAO,IAAIE,KAAJ,CAAUP,UAAV,EAAsBQ,IAAtB,CAA2B,EAA3B,CAAP;AACD,KAFiB,CAAlB,CADqD,CAKrD;AACA;AACA;;AAEAJ,IAAAA,KAAK,CAACK,OAAN,CAAc,CAACC,KAAD,EAAQC,MAAR,KAAmB;AAC/B,YAAMC,SAAS,GAAG,uBAASF,KAAT,EAAgBX,MAAM,CAACc,OAAP,CAAeF,MAAf,EAAuBG,KAAvC,EAA8Cf,MAAM,CAACc,OAAP,CAAeF,MAAf,EAAuBI,QAArE,CAAlB;AAEAH,MAAAA,SAAS,CAACH,OAAV,CAAkB,CAACO,QAAD,EAAWC,MAAX,KAAsB;AACtCX,QAAAA,SAAS,CAACW,MAAD,CAAT,CAAkBN,MAAlB,IAA4BK,QAA5B;AACD,OAFD;AAGD,KAND;AAQA,WAAOV,SAAP;AACD,GAlBkB,CAAnB;AAoBA,SAAO,uBAAUJ,UAAV,CAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport wrapCell from './wrapCell';\n\n/**\n * @param {Array} unmappedRows\n * @param {number[]} rowHeightIndex\n * @param {Object} config\n * @returns {Array}\n */\nexport default (unmappedRows, rowHeightIndex, config) => {\n const tableWidth = unmappedRows[0].length;\n\n const mappedRows = unmappedRows.map((cells, index0) => {\n const rowHeight = _.times(rowHeightIndex[index0], () => {\n return new Array(tableWidth).fill('');\n });\n\n // rowHeight\n // [{row index within rowSaw; index2}]\n // [{cell index within a virtual row; index1}]\n\n cells.forEach((value, index1) => {\n const cellLines = wrapCell(value, config.columns[index1].width, config.columns[index1].wrapWord);\n\n cellLines.forEach((cellLine, index2) => {\n rowHeight[index2][index1] = cellLine;\n });\n });\n\n return rowHeight;\n });\n\n return _.flatten(mappedRows);\n};\n"],"file":"mapDataUsingRowHeightIndex.js"}
|
24
node_modules/table/dist/padTableData.js
generated
vendored
Normal file
24
node_modules/table/dist/padTableData.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
const padTableData = (rows, config) => {
|
||||
return rows.map(cells => {
|
||||
return cells.map((value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var _default = padTableData;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=padTableData.js.map
|
14
node_modules/table/dist/padTableData.js.flow
generated
vendored
Normal file
14
node_modules/table/dist/padTableData.js.flow
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
export default (rows, config) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map((value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
|
||||
return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);
|
||||
});
|
||||
});
|
||||
};
|
1
node_modules/table/dist/padTableData.js.map
generated
vendored
Normal file
1
node_modules/table/dist/padTableData.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/padTableData.js"],"names":["rows","config","map","cells","value","index1","column","columns","repeat","paddingLeft","paddingRight"],"mappings":";;;;;;;AAAA;;;;;sBAKgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,KAAD,EAAQC,MAAR,KAAmB;AAClC,YAAMC,MAAM,GAAGL,MAAM,CAACM,OAAP,CAAeF,MAAf,CAAf;AAEA,aAAO,IAAIG,MAAJ,CAAWF,MAAM,CAACG,WAAlB,IAAiCL,KAAjC,GAAyC,IAAII,MAAJ,CAAWF,MAAM,CAACI,YAAlB,CAAhD;AACD,KAJM,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["/**\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((value, index1) => {\n const column = config.columns[index1];\n\n return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);\n });\n });\n};\n"],"file":"padTableData.js"}
|
114
node_modules/table/dist/schemas/config.json
generated
vendored
Normal file
114
node_modules/table/dist/schemas/config.json
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
{
|
||||
"$id": "config.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"border": {
|
||||
"$ref": "#/definitions/borders"
|
||||
},
|
||||
"columns": {
|
||||
"$ref": "#/definitions/columns"
|
||||
},
|
||||
"columnDefault": {
|
||||
"$ref": "#/definitions/column"
|
||||
},
|
||||
"drawHorizontalLine": {
|
||||
"typeof": "function"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"columns": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+$": {
|
||||
"$ref": "#/definitions/column"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"column": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alignment": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"left",
|
||||
"right",
|
||||
"center"
|
||||
]
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
},
|
||||
"wrapWord": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"truncate": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingRight": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"borders": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"border": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
114
node_modules/table/dist/schemas/streamConfig.json
generated
vendored
Normal file
114
node_modules/table/dist/schemas/streamConfig.json
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
{
|
||||
"$id": "streamConfig.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"border": {
|
||||
"$ref": "#/definitions/borders"
|
||||
},
|
||||
"columns": {
|
||||
"$ref": "#/definitions/columns"
|
||||
},
|
||||
"columnDefault": {
|
||||
"$ref": "#/definitions/column"
|
||||
},
|
||||
"columnCount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"columns": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+$": {
|
||||
"$ref": "#/definitions/column"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"column": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alignment": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"left",
|
||||
"right",
|
||||
"center"
|
||||
]
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
},
|
||||
"wrapWord": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"truncate": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingRight": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"borders": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"border": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
22
node_modules/table/dist/stringifyTableData.js
generated
vendored
Normal file
22
node_modules/table/dist/stringifyTableData.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* Casts all cell values to a string.
|
||||
*
|
||||
* @param {table~row[]} rows
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
const stringifyTableData = rows => {
|
||||
return rows.map(cells => {
|
||||
return cells.map(String);
|
||||
});
|
||||
};
|
||||
|
||||
var _default = stringifyTableData;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=stringifyTableData.js.map
|
11
node_modules/table/dist/stringifyTableData.js.flow
generated
vendored
Normal file
11
node_modules/table/dist/stringifyTableData.js.flow
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Casts all cell values to a string.
|
||||
*
|
||||
* @param {table~row[]} rows
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
export default (rows) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map(String);
|
||||
});
|
||||
};
|
1
node_modules/table/dist/stringifyTableData.js.map
generated
vendored
Normal file
1
node_modules/table/dist/stringifyTableData.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/stringifyTableData.js"],"names":["rows","map","cells","String"],"mappings":";;;;;;;AAAA;;;;;;2BAMgBA,I,IAAS;AACvB,SAAOA,IAAI,CAACC,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAUE,MAAV,CAAP;AACD,GAFM,CAAP;AAGD,C","sourcesContent":["/**\n * Casts all cell values to a string.\n *\n * @param {table~row[]} rows\n * @returns {table~row[]}\n */\nexport default (rows) => {\n return rows.map((cells) => {\n return cells.map(String);\n });\n};\n"],"file":"stringifyTableData.js"}
|
110
node_modules/table/dist/table.js
generated
vendored
Normal file
110
node_modules/table/dist/table.js
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _drawTable = _interopRequireDefault(require("./drawTable"));
|
||||
|
||||
var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex"));
|
||||
|
||||
var _makeConfig = _interopRequireDefault(require("./makeConfig"));
|
||||
|
||||
var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex"));
|
||||
|
||||
var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex"));
|
||||
|
||||
var _alignTableData = _interopRequireDefault(require("./alignTableData"));
|
||||
|
||||
var _padTableData = _interopRequireDefault(require("./padTableData"));
|
||||
|
||||
var _validateTableData = _interopRequireDefault(require("./validateTableData"));
|
||||
|
||||
var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData"));
|
||||
|
||||
var _truncateTableData = _interopRequireDefault(require("./truncateTableData"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @typedef {string} table~cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {table~cell[]} table~row
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~columns
|
||||
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
|
||||
* @property {number} width Column width (default: auto).
|
||||
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
|
||||
* @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters
|
||||
* @property {number} paddingLeft Cell content padding width left (default: 1).
|
||||
* @property {number} paddingRight Cell content padding width right (default: 1).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to tell whether to draw a horizontal line.
|
||||
* This callback is called for each non-content line of the table.
|
||||
* The default behavior is to always return true.
|
||||
*
|
||||
* @typedef {Function} drawHorizontalLine
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~config
|
||||
* @property {table~border} border
|
||||
* @property {table~columns[]} columns Column specific configuration.
|
||||
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
||||
* @property {table~drawHorizontalLine} drawHorizontalLine
|
||||
* @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates a text table.
|
||||
*
|
||||
* @param {table~row[]} data
|
||||
* @param {table~config} userConfig
|
||||
* @returns {string}
|
||||
*/
|
||||
const table = (data, userConfig = {}) => {
|
||||
let rows;
|
||||
(0, _validateTableData.default)(data);
|
||||
rows = (0, _stringifyTableData.default)(data);
|
||||
const config = (0, _makeConfig.default)(rows, userConfig);
|
||||
rows = (0, _truncateTableData.default)(data, config);
|
||||
const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config);
|
||||
rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config);
|
||||
rows = (0, _alignTableData.default)(rows, config);
|
||||
rows = (0, _padTableData.default)(rows, config);
|
||||
const cellWidthIndex = (0, _calculateCellWidthIndex.default)(rows[0]);
|
||||
return (0, _drawTable.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine, config.singleLine);
|
||||
};
|
||||
|
||||
var _default = table;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=table.js.map
|
96
node_modules/table/dist/table.js.flow
generated
vendored
Normal file
96
node_modules/table/dist/table.js.flow
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
import drawTable from './drawTable';
|
||||
import calculateCellWidthIndex from './calculateCellWidthIndex';
|
||||
import makeConfig from './makeConfig';
|
||||
import calculateRowHeightIndex from './calculateRowHeightIndex';
|
||||
import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';
|
||||
import alignTableData from './alignTableData';
|
||||
import padTableData from './padTableData';
|
||||
import validateTableData from './validateTableData';
|
||||
import stringifyTableData from './stringifyTableData';
|
||||
import truncateTableData from './truncateTableData';
|
||||
|
||||
/**
|
||||
* @typedef {string} table~cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {table~cell[]} table~row
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~columns
|
||||
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
|
||||
* @property {number} width Column width (default: auto).
|
||||
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
|
||||
* @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters
|
||||
* @property {number} paddingLeft Cell content padding width left (default: 1).
|
||||
* @property {number} paddingRight Cell content padding width right (default: 1).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used to tell whether to draw a horizontal line.
|
||||
* This callback is called for each non-content line of the table.
|
||||
* The default behavior is to always return true.
|
||||
*
|
||||
* @typedef {Function} drawHorizontalLine
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} table~config
|
||||
* @property {table~border} border
|
||||
* @property {table~columns[]} columns Column specific configuration.
|
||||
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
||||
* @property {table~drawHorizontalLine} drawHorizontalLine
|
||||
* @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates a text table.
|
||||
*
|
||||
* @param {table~row[]} data
|
||||
* @param {table~config} userConfig
|
||||
* @returns {string}
|
||||
*/
|
||||
export default (data, userConfig = {}) => {
|
||||
let rows;
|
||||
|
||||
validateTableData(data);
|
||||
|
||||
rows = stringifyTableData(data);
|
||||
|
||||
const config = makeConfig(rows, userConfig);
|
||||
|
||||
rows = truncateTableData(data, config);
|
||||
|
||||
const rowHeightIndex = calculateRowHeightIndex(rows, config);
|
||||
|
||||
rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);
|
||||
rows = alignTableData(rows, config);
|
||||
rows = padTableData(rows, config);
|
||||
|
||||
const cellWidthIndex = calculateCellWidthIndex(rows[0]);
|
||||
|
||||
return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine, config.singleLine);
|
||||
};
|
1
node_modules/table/dist/table.js.map
generated
vendored
Normal file
1
node_modules/table/dist/table.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/table.js"],"names":["data","userConfig","rows","config","rowHeightIndex","cellWidthIndex","border","drawHorizontalLine","singleLine"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;;;;AAIA;;;;AAIA;;;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;;;;AAWA;;;;;;;;;AASA;;;;;;;eAOgBA,I,EAAMC,UAAU,GAAG,E,KAAO;AACxC,MAAIC,IAAJ;AAEA,kCAAkBF,IAAlB;AAEAE,EAAAA,IAAI,GAAG,iCAAmBF,IAAnB,CAAP;AAEA,QAAMG,MAAM,GAAG,yBAAWD,IAAX,EAAiBD,UAAjB,CAAf;AAEAC,EAAAA,IAAI,GAAG,gCAAkBF,IAAlB,EAAwBG,MAAxB,CAAP;AAEA,QAAMC,cAAc,GAAG,sCAAwBF,IAAxB,EAA8BC,MAA9B,CAAvB;AAEAD,EAAAA,IAAI,GAAG,yCAA2BA,IAA3B,EAAiCE,cAAjC,EAAiDD,MAAjD,CAAP;AACAD,EAAAA,IAAI,GAAG,6BAAeA,IAAf,EAAqBC,MAArB,CAAP;AACAD,EAAAA,IAAI,GAAG,2BAAaA,IAAb,EAAmBC,MAAnB,CAAP;AAEA,QAAME,cAAc,GAAG,sCAAwBH,IAAI,CAAC,CAAD,CAA5B,CAAvB;AAEA,SAAO,wBAAUA,IAAV,EAAgBC,MAAM,CAACG,MAAvB,EAA+BD,cAA/B,EAA+CD,cAA/C,EAA+DD,MAAM,CAACI,kBAAtE,EAA0FJ,MAAM,CAACK,UAAjG,CAAP;AACD,C","sourcesContent":["import drawTable from './drawTable';\nimport calculateCellWidthIndex from './calculateCellWidthIndex';\nimport makeConfig from './makeConfig';\nimport calculateRowHeightIndex from './calculateRowHeightIndex';\nimport mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';\nimport alignTableData from './alignTableData';\nimport padTableData from './padTableData';\nimport validateTableData from './validateTableData';\nimport stringifyTableData from './stringifyTableData';\nimport truncateTableData from './truncateTableData';\n\n/**\n * @typedef {string} table~cell\n */\n\n/**\n * @typedef {table~cell[]} table~row\n */\n\n/**\n * @typedef {Object} table~columns\n * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).\n * @property {number} width Column width (default: auto).\n * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).\n * @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters\n * @property {number} paddingLeft Cell content padding width left (default: 1).\n * @property {number} paddingRight Cell content padding width right (default: 1).\n */\n\n/**\n * @typedef {Object} table~border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * Used to tell whether to draw a horizontal line.\n * This callback is called for each non-content line of the table.\n * The default behavior is to always return true.\n *\n * @typedef {Function} drawHorizontalLine\n * @param {number} index\n * @param {number} size\n * @returns {boolean}\n */\n\n/**\n * @typedef {Object} table~config\n * @property {table~border} border\n * @property {table~columns[]} columns Column specific configuration.\n * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.\n * @property {table~drawHorizontalLine} drawHorizontalLine\n * @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.\n */\n\n/**\n * Generates a text table.\n *\n * @param {table~row[]} data\n * @param {table~config} userConfig\n * @returns {string}\n */\nexport default (data, userConfig = {}) => {\n let rows;\n\n validateTableData(data);\n\n rows = stringifyTableData(data);\n\n const config = makeConfig(rows, userConfig);\n\n rows = truncateTableData(data, config);\n\n const rowHeightIndex = calculateRowHeightIndex(rows, config);\n\n rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);\n rows = alignTableData(rows, config);\n rows = padTableData(rows, config);\n\n const cellWidthIndex = calculateCellWidthIndex(rows[0]);\n\n return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine, config.singleLine);\n};\n"],"file":"table.js"}
|
30
node_modules/table/dist/truncateTableData.js
generated
vendored
Normal file
30
node_modules/table/dist/truncateTableData.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _truncate2 = _interopRequireDefault(require("lodash/truncate"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @todo Make it work with ASCII content.
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
const truncateTableData = (rows, config) => {
|
||||
return rows.map(cells => {
|
||||
return cells.map((content, index) => {
|
||||
return (0, _truncate2.default)(content, {
|
||||
length: config.columns[index].truncate
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var _default = truncateTableData;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=truncateTableData.js.map
|
17
node_modules/table/dist/truncateTableData.js.flow
generated
vendored
Normal file
17
node_modules/table/dist/truncateTableData.js.flow
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
/**
|
||||
* @todo Make it work with ASCII content.
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
export default (rows, config) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map((content, index) => {
|
||||
return _.truncate(content, {
|
||||
length: config.columns[index].truncate
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
1
node_modules/table/dist/truncateTableData.js.map
generated
vendored
Normal file
1
node_modules/table/dist/truncateTableData.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/truncateTableData.js"],"names":["rows","config","map","cells","content","index","length","columns","truncate"],"mappings":";;;;;;;;;;;AAEA;;;;;;2BAMgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,OAAD,EAAUC,KAAV,KAAoB;AACnC,aAAO,wBAAWD,OAAX,EAAoB;AACzBE,QAAAA,MAAM,EAAEL,MAAM,CAACM,OAAP,CAAeF,KAAf,EAAsBG;AADL,OAApB,CAAP;AAGD,KAJM,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["import _ from 'lodash';\n\n/**\n * @todo Make it work with ASCII content.\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((content, index) => {\n return _.truncate(content, {\n length: config.columns[index].truncate\n });\n });\n });\n};\n"],"file":"truncateTableData.js"}
|
752
node_modules/table/dist/validateConfig.js
generated
vendored
Normal file
752
node_modules/table/dist/validateConfig.js
generated
vendored
Normal file
@ -0,0 +1,752 @@
|
||||
'use strict';
|
||||
var equal = require('ajv/lib/compile/equal');
|
||||
var validate = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
var refVal = [];
|
||||
var refVal1 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (rootData === undefined) rootData = data;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0));
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
if (data.topBody !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal2.errors;
|
||||
else vErrors = vErrors.concat(refVal2.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.topJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.topLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.topRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomBody !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bodyLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bodyRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bodyJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinBody !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal1.schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
};
|
||||
refVal1.errors = null;
|
||||
refVal[1] = refVal1;
|
||||
var refVal2 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (typeof data !== "string") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'string'
|
||||
},
|
||||
message: 'should be string'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal2.schema = {
|
||||
"type": "string"
|
||||
};
|
||||
refVal2.errors = null;
|
||||
refVal[2] = refVal2;
|
||||
var refVal3 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (rootData === undefined) rootData = data;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || pattern0.test(key0));
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
for (var key0 in data) {
|
||||
if (pattern0.test(key0)) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
|
||||
if (vErrors === null) vErrors = refVal4.errors;
|
||||
else vErrors = vErrors.concat(refVal4.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal3.schema = {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+$": {
|
||||
"$ref": "#/definitions/column"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
};
|
||||
refVal3.errors = null;
|
||||
refVal[3] = refVal3;
|
||||
var refVal4 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight');
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
var data1 = data.alignment;
|
||||
if (data1 !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data1 !== "string") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.alignment',
|
||||
schemaPath: '#/properties/alignment/type',
|
||||
params: {
|
||||
type: 'string'
|
||||
},
|
||||
message: 'should be string'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var schema1 = validate.schema.properties.alignment.enum;
|
||||
var valid1;
|
||||
valid1 = false;
|
||||
for (var i1 = 0; i1 < schema1.length; i1++)
|
||||
if (equal(data1, schema1[i1])) {
|
||||
valid1 = true;
|
||||
break;
|
||||
} if (!valid1) {
|
||||
var err = {
|
||||
keyword: 'enum',
|
||||
dataPath: (dataPath || '') + '.alignment',
|
||||
schemaPath: '#/properties/alignment/enum',
|
||||
params: {
|
||||
allowedValues: schema1
|
||||
},
|
||||
message: 'should be equal to one of the allowed values'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.width !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.width !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.width',
|
||||
schemaPath: '#/properties/width/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.wrapWord !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.wrapWord !== "boolean") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.wrapWord',
|
||||
schemaPath: '#/properties/wrapWord/type',
|
||||
params: {
|
||||
type: 'boolean'
|
||||
},
|
||||
message: 'should be boolean'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.truncate !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.truncate !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.truncate',
|
||||
schemaPath: '#/properties/truncate/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.paddingLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.paddingLeft !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.paddingLeft',
|
||||
schemaPath: '#/properties/paddingLeft/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.paddingRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.paddingRight !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.paddingRight',
|
||||
schemaPath: '#/properties/paddingRight/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal4.schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alignment": {
|
||||
"type": "string",
|
||||
"enum": ["left", "right", "center"]
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
},
|
||||
"wrapWord": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"truncate": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingRight": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
};
|
||||
refVal4.errors = null;
|
||||
refVal[4] = refVal4;
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict'; /*# sourceURL=config.json */
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (rootData === undefined) rootData = data;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'drawHorizontalLine');
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
if (data.border !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal1.errors;
|
||||
else vErrors = vErrors.concat(refVal1.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.columns !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal3.errors;
|
||||
else vErrors = vErrors.concat(refVal3.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.columnDefault !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[4].errors;
|
||||
else vErrors = vErrors.concat(refVal[4].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.drawHorizontalLine !== undefined) {
|
||||
var errs_1 = errors;
|
||||
var errs__1 = errors;
|
||||
var valid1;
|
||||
valid1 = typeof data.drawHorizontalLine == "function";
|
||||
if (!valid1) {
|
||||
if (errs__1 == errors) {
|
||||
var err = {
|
||||
keyword: 'typeof',
|
||||
dataPath: (dataPath || '') + '.drawHorizontalLine',
|
||||
schemaPath: '#/properties/drawHorizontalLine/typeof',
|
||||
params: {
|
||||
keyword: 'typeof'
|
||||
},
|
||||
message: 'should pass "typeof" keyword validation'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
} else {
|
||||
for (var i1 = errs__1; i1 < errors; i1++) {
|
||||
var ruleErr1 = vErrors[i1];
|
||||
if (ruleErr1.dataPath === undefined) ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine';
|
||||
if (ruleErr1.schemaPath === undefined) {
|
||||
ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
validate.schema = {
|
||||
"$id": "config.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"border": {
|
||||
"$ref": "#/definitions/borders"
|
||||
},
|
||||
"columns": {
|
||||
"$ref": "#/definitions/columns"
|
||||
},
|
||||
"columnDefault": {
|
||||
"$ref": "#/definitions/column"
|
||||
},
|
||||
"drawHorizontalLine": {
|
||||
"typeof": "function"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"columns": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+$": {
|
||||
"$ref": "#/definitions/column"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"column": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alignment": {
|
||||
"type": "string",
|
||||
"enum": ["left", "right", "center"]
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
},
|
||||
"wrapWord": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"truncate": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingRight": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"borders": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"border": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
};
|
||||
validate.errors = null;
|
||||
module.exports = validate;
|
34
node_modules/table/dist/validateConfig.js.flow
generated
vendored
Normal file
34
node_modules/table/dist/validateConfig.js.flow
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// eslint-disable-next-line import/default
|
||||
import validateConfig from '../dist/validateConfig';
|
||||
// eslint-disable-next-line import/default
|
||||
import validateStreamConfig from '../dist/validateStreamConfig';
|
||||
|
||||
const validate = {
|
||||
'config.json': validateConfig,
|
||||
'streamConfig.json': validateStreamConfig
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} schemaId
|
||||
* @param {formatData~config} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
export default (schemaId, config = {}) => {
|
||||
if (!validate[schemaId](config)) {
|
||||
const errors = validate[schemaId].errors.map((error) => {
|
||||
return {
|
||||
dataPath: error.dataPath,
|
||||
message: error.message,
|
||||
params: error.params,
|
||||
schemaPath: error.schemaPath
|
||||
};
|
||||
});
|
||||
|
||||
/* eslint-disable no-console */
|
||||
console.log('config', config);
|
||||
console.log('errors', errors);
|
||||
/* eslint-enable no-console */
|
||||
|
||||
throw new Error('Invalid config.');
|
||||
}
|
||||
};
|
1
node_modules/table/dist/validateConfig.js.map
generated
vendored
Normal file
1
node_modules/table/dist/validateConfig.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/validateConfig.js"],"names":["validate","validateConfig","validateStreamConfig","schemaId","config","errors","map","error","dataPath","message","params","schemaPath","console","log","Error"],"mappings":";;;;;;;AACA;;AAEA;;;;AAHA;AAEA;AAGA,MAAMA,QAAQ,GAAG;AACf,iBAAeC,uBADA;AAEf,uBAAqBC;AAFN,CAAjB;AAKA;;;;;;yBAKgBC,Q,EAAUC,MAAM,GAAG,E,KAAO;AACxC,MAAI,CAACJ,QAAQ,CAACG,QAAD,CAAR,CAAmBC,MAAnB,CAAL,EAAiC;AAC/B,UAAMC,MAAM,GAAGL,QAAQ,CAACG,QAAD,CAAR,CAAmBE,MAAnB,CAA0BC,GAA1B,CAA+BC,KAAD,IAAW;AACtD,aAAO;AACLC,QAAAA,QAAQ,EAAED,KAAK,CAACC,QADX;AAELC,QAAAA,OAAO,EAAEF,KAAK,CAACE,OAFV;AAGLC,QAAAA,MAAM,EAAEH,KAAK,CAACG,MAHT;AAILC,QAAAA,UAAU,EAAEJ,KAAK,CAACI;AAJb,OAAP;AAMD,KAPc,CAAf;AASA;;AACAC,IAAAA,OAAO,CAACC,GAAR,CAAY,QAAZ,EAAsBT,MAAtB;AACAQ,IAAAA,OAAO,CAACC,GAAR,CAAY,QAAZ,EAAsBR,MAAtB;AACA;;AAEA,UAAM,IAAIS,KAAJ,CAAU,iBAAV,CAAN;AACD;AACF,C","sourcesContent":["// eslint-disable-next-line import/default\nimport validateConfig from '../dist/validateConfig';\n// eslint-disable-next-line import/default\nimport validateStreamConfig from '../dist/validateStreamConfig';\n\nconst validate = {\n 'config.json': validateConfig,\n 'streamConfig.json': validateStreamConfig\n};\n\n/**\n * @param {string} schemaId\n * @param {formatData~config} config\n * @returns {undefined}\n */\nexport default (schemaId, config = {}) => {\n if (!validate[schemaId](config)) {\n const errors = validate[schemaId].errors.map((error) => {\n return {\n dataPath: error.dataPath,\n message: error.message,\n params: error.params,\n schemaPath: error.schemaPath\n };\n });\n\n /* eslint-disable no-console */\n console.log('config', config);\n console.log('errors', errors);\n /* eslint-enable no-console */\n\n throw new Error('Invalid config.');\n }\n};\n"],"file":"validateConfig.js"}
|
739
node_modules/table/dist/validateStreamConfig.js
generated
vendored
Normal file
739
node_modules/table/dist/validateStreamConfig.js
generated
vendored
Normal file
@ -0,0 +1,739 @@
|
||||
'use strict';
|
||||
var equal = require('ajv/lib/compile/equal');
|
||||
var validate = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
var refVal = [];
|
||||
var refVal1 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (rootData === undefined) rootData = data;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0));
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
if (data.topBody !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal2.errors;
|
||||
else vErrors = vErrors.concat(refVal2.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.topJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.topLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.topRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomBody !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bottomRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bodyLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bodyRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.bodyJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinBody !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.joinJoin !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[2].errors;
|
||||
else vErrors = vErrors.concat(refVal[2].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal1.schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
};
|
||||
refVal1.errors = null;
|
||||
refVal[1] = refVal1;
|
||||
var refVal2 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (typeof data !== "string") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'string'
|
||||
},
|
||||
message: 'should be string'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal2.schema = {
|
||||
"type": "string"
|
||||
};
|
||||
refVal2.errors = null;
|
||||
refVal[2] = refVal2;
|
||||
var refVal3 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (rootData === undefined) rootData = data;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || pattern0.test(key0));
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
for (var key0 in data) {
|
||||
if (pattern0.test(key0)) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
|
||||
if (vErrors === null) vErrors = refVal4.errors;
|
||||
else vErrors = vErrors.concat(refVal4.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal3.schema = {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+$": {
|
||||
"$ref": "#/definitions/column"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
};
|
||||
refVal3.errors = null;
|
||||
refVal[3] = refVal3;
|
||||
var refVal4 = (function() {
|
||||
var pattern0 = new RegExp('^[0-9]+$');
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight');
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
var data1 = data.alignment;
|
||||
if (data1 !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data1 !== "string") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.alignment',
|
||||
schemaPath: '#/properties/alignment/type',
|
||||
params: {
|
||||
type: 'string'
|
||||
},
|
||||
message: 'should be string'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var schema1 = validate.schema.properties.alignment.enum;
|
||||
var valid1;
|
||||
valid1 = false;
|
||||
for (var i1 = 0; i1 < schema1.length; i1++)
|
||||
if (equal(data1, schema1[i1])) {
|
||||
valid1 = true;
|
||||
break;
|
||||
} if (!valid1) {
|
||||
var err = {
|
||||
keyword: 'enum',
|
||||
dataPath: (dataPath || '') + '.alignment',
|
||||
schemaPath: '#/properties/alignment/enum',
|
||||
params: {
|
||||
allowedValues: schema1
|
||||
},
|
||||
message: 'should be equal to one of the allowed values'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.width !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.width !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.width',
|
||||
schemaPath: '#/properties/width/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.wrapWord !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.wrapWord !== "boolean") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.wrapWord',
|
||||
schemaPath: '#/properties/wrapWord/type',
|
||||
params: {
|
||||
type: 'boolean'
|
||||
},
|
||||
message: 'should be boolean'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.truncate !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.truncate !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.truncate',
|
||||
schemaPath: '#/properties/truncate/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.paddingLeft !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.paddingLeft !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.paddingLeft',
|
||||
schemaPath: '#/properties/paddingLeft/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.paddingRight !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.paddingRight !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.paddingRight',
|
||||
schemaPath: '#/properties/paddingRight/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
refVal4.schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alignment": {
|
||||
"type": "string",
|
||||
"enum": ["left", "right", "center"]
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
},
|
||||
"wrapWord": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"truncate": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingRight": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
};
|
||||
refVal4.errors = null;
|
||||
refVal[4] = refVal4;
|
||||
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict'; /*# sourceURL=streamConfig.json */
|
||||
var vErrors = null;
|
||||
var errors = 0;
|
||||
if (rootData === undefined) rootData = data;
|
||||
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
||||
var errs__0 = errors;
|
||||
var valid1 = true;
|
||||
for (var key0 in data) {
|
||||
var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'columnCount');
|
||||
if (isAdditional0) {
|
||||
valid1 = false;
|
||||
var err = {
|
||||
keyword: 'additionalProperties',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/additionalProperties',
|
||||
params: {
|
||||
additionalProperty: '' + key0 + ''
|
||||
},
|
||||
message: 'should NOT have additional properties'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
if (data.border !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal1.errors;
|
||||
else vErrors = vErrors.concat(refVal1.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.columns !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal3.errors;
|
||||
else vErrors = vErrors.concat(refVal3.errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.columnDefault !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
|
||||
if (vErrors === null) vErrors = refVal[4].errors;
|
||||
else vErrors = vErrors.concat(refVal[4].errors);
|
||||
errors = vErrors.length;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
if (data.columnCount !== undefined) {
|
||||
var errs_1 = errors;
|
||||
if (typeof data.columnCount !== "number") {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + '.columnCount',
|
||||
schemaPath: '#/properties/columnCount/type',
|
||||
params: {
|
||||
type: 'number'
|
||||
},
|
||||
message: 'should be number'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
var valid1 = errors === errs_1;
|
||||
}
|
||||
} else {
|
||||
var err = {
|
||||
keyword: 'type',
|
||||
dataPath: (dataPath || '') + "",
|
||||
schemaPath: '#/type',
|
||||
params: {
|
||||
type: 'object'
|
||||
},
|
||||
message: 'should be object'
|
||||
};
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
}
|
||||
validate.errors = vErrors;
|
||||
return errors === 0;
|
||||
};
|
||||
})();
|
||||
validate.schema = {
|
||||
"$id": "streamConfig.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"border": {
|
||||
"$ref": "#/definitions/borders"
|
||||
},
|
||||
"columns": {
|
||||
"$ref": "#/definitions/columns"
|
||||
},
|
||||
"columnDefault": {
|
||||
"$ref": "#/definitions/column"
|
||||
},
|
||||
"columnCount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"columns": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+$": {
|
||||
"$ref": "#/definitions/column"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"column": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alignment": {
|
||||
"type": "string",
|
||||
"enum": ["left", "right", "center"]
|
||||
},
|
||||
"width": {
|
||||
"type": "number"
|
||||
},
|
||||
"wrapWord": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"truncate": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"type": "number"
|
||||
},
|
||||
"paddingRight": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"borders": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"topBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"topRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bottomRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"bodyJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinBody": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinLeft": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinRight": {
|
||||
"$ref": "#/definitions/border"
|
||||
},
|
||||
"joinJoin": {
|
||||
"$ref": "#/definitions/border"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"border": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
};
|
||||
validate.errors = null;
|
||||
module.exports = validate;
|
96
node_modules/table/dist/validateTableData.js
generated
vendored
Normal file
96
node_modules/table/dist/validateTableData.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* @typedef {string} cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {cell[]} validateData~column
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {column[]} rows
|
||||
* @returns {undefined}
|
||||
*/
|
||||
const validateTableData = rows => {
|
||||
if (!Array.isArray(rows)) {
|
||||
throw new TypeError('Table data must be an array.');
|
||||
}
|
||||
|
||||
if (rows.length === 0) {
|
||||
throw new Error('Table must define at least one row.');
|
||||
}
|
||||
|
||||
if (rows[0].length === 0) {
|
||||
throw new Error('Table must define at least one column.');
|
||||
}
|
||||
|
||||
const columnNumber = rows[0].length;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
const cells = _step.value;
|
||||
|
||||
if (!Array.isArray(cells)) {
|
||||
throw new TypeError('Table row data must be an array.');
|
||||
}
|
||||
|
||||
if (cells.length !== columnNumber) {
|
||||
throw new Error('Table must have a consistent number of cells.');
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = cells[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
const cell = _step2.value;
|
||||
|
||||
// eslint-disable-next-line no-control-regex
|
||||
if (/[\u0001-\u0006\u0008-\u0009\u000B-\u001A]/.test(cell)) {
|
||||
throw new Error('Table data must not contain control characters.');
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var _default = validateTableData;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=validateTableData.js.map
|
44
node_modules/table/dist/validateTableData.js.flow
generated
vendored
Normal file
44
node_modules/table/dist/validateTableData.js.flow
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @typedef {string} cell
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {cell[]} validateData~column
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {column[]} rows
|
||||
* @returns {undefined}
|
||||
*/
|
||||
export default (rows) => {
|
||||
if (!Array.isArray(rows)) {
|
||||
throw new TypeError('Table data must be an array.');
|
||||
}
|
||||
|
||||
if (rows.length === 0) {
|
||||
throw new Error('Table must define at least one row.');
|
||||
}
|
||||
|
||||
if (rows[0].length === 0) {
|
||||
throw new Error('Table must define at least one column.');
|
||||
}
|
||||
|
||||
const columnNumber = rows[0].length;
|
||||
|
||||
for (const cells of rows) {
|
||||
if (!Array.isArray(cells)) {
|
||||
throw new TypeError('Table row data must be an array.');
|
||||
}
|
||||
|
||||
if (cells.length !== columnNumber) {
|
||||
throw new Error('Table must have a consistent number of cells.');
|
||||
}
|
||||
|
||||
for (const cell of cells) {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
if (/[\u0001-\u0006\u0008-\u0009\u000B-\u001A]/.test(cell)) {
|
||||
throw new Error('Table data must not contain control characters.');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
1
node_modules/table/dist/validateTableData.js.map
generated
vendored
Normal file
1
node_modules/table/dist/validateTableData.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/validateTableData.js"],"names":["rows","Array","isArray","TypeError","length","Error","columnNumber","cells","cell","test"],"mappings":";;;;;;;AAAA;;;;AAIA;;;;AAIA;;;;0BAIgBA,I,IAAS;AACvB,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,IAAd,CAAL,EAA0B;AACxB,UAAM,IAAIG,SAAJ,CAAc,8BAAd,CAAN;AACD;;AAED,MAAIH,IAAI,CAACI,MAAL,KAAgB,CAApB,EAAuB;AACrB,UAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;AACD;;AAED,MAAIL,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAR,KAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAIC,KAAJ,CAAU,wCAAV,CAAN;AACD;;AAED,QAAMC,YAAY,GAAGN,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAA7B;AAbuB;AAAA;AAAA;;AAAA;AAevB,yBAAoBJ,IAApB,8HAA0B;AAAA,YAAfO,KAAe;;AACxB,UAAI,CAACN,KAAK,CAACC,OAAN,CAAcK,KAAd,CAAL,EAA2B;AACzB,cAAM,IAAIJ,SAAJ,CAAc,kCAAd,CAAN;AACD;;AAED,UAAII,KAAK,CAACH,MAAN,KAAiBE,YAArB,EAAmC;AACjC,cAAM,IAAID,KAAJ,CAAU,+CAAV,CAAN;AACD;;AAPuB;AAAA;AAAA;;AAAA;AASxB,8BAAmBE,KAAnB,mIAA0B;AAAA,gBAAfC,IAAe;;AACxB;AACA,cAAI,4CAA4CC,IAA5C,CAAiDD,IAAjD,CAAJ,EAA4D;AAC1D,kBAAM,IAAIH,KAAJ,CAAU,iDAAV,CAAN;AACD;AACF;AAduB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAezB;AA9BsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BxB,C","sourcesContent":["/**\n * @typedef {string} cell\n */\n\n/**\n * @typedef {cell[]} validateData~column\n */\n\n/**\n * @param {column[]} rows\n * @returns {undefined}\n */\nexport default (rows) => {\n if (!Array.isArray(rows)) {\n throw new TypeError('Table data must be an array.');\n }\n\n if (rows.length === 0) {\n throw new Error('Table must define at least one row.');\n }\n\n if (rows[0].length === 0) {\n throw new Error('Table must define at least one column.');\n }\n\n const columnNumber = rows[0].length;\n\n for (const cells of rows) {\n if (!Array.isArray(cells)) {\n throw new TypeError('Table row data must be an array.');\n }\n\n if (cells.length !== columnNumber) {\n throw new Error('Table must have a consistent number of cells.');\n }\n\n for (const cell of cells) {\n // eslint-disable-next-line no-control-regex\n if (/[\\u0001-\\u0006\\u0008-\\u0009\\u000B-\\u001A]/.test(cell)) {\n throw new Error('Table data must not contain control characters.');\n }\n }\n }\n};\n"],"file":"validateTableData.js"}
|
48
node_modules/table/dist/wrapCell.js
generated
vendored
Normal file
48
node_modules/table/dist/wrapCell.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _wrapString = _interopRequireDefault(require("./wrapString"));
|
||||
|
||||
var _wrapWord = _interopRequireDefault(require("./wrapWord"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Wrap a single cell value into a list of lines
|
||||
*
|
||||
* Always wraps on newlines, for the remainder uses either word or string wrapping
|
||||
* depending on user configuration.
|
||||
*
|
||||
* @param {string} cellValue
|
||||
* @param {number} columnWidth
|
||||
* @param {boolean} useWrapWord
|
||||
* @returns {Array}
|
||||
*/
|
||||
const wrapCell = (cellValue, columnWidth, useWrapWord) => {
|
||||
// First split on literal newlines
|
||||
const cellLines = cellValue.split('\n'); // Then iterate over the list and word-wrap every remaining line if necessary.
|
||||
|
||||
for (let lineNr = 0; lineNr < cellLines.length;) {
|
||||
let lineChunks;
|
||||
|
||||
if (useWrapWord) {
|
||||
lineChunks = (0, _wrapWord.default)(cellLines[lineNr], columnWidth);
|
||||
} else {
|
||||
lineChunks = (0, _wrapString.default)(cellLines[lineNr], columnWidth);
|
||||
} // Replace our original array element with whatever the wrapping returned
|
||||
|
||||
|
||||
cellLines.splice(lineNr, 1, ...lineChunks);
|
||||
lineNr += lineChunks.length;
|
||||
}
|
||||
|
||||
return cellLines;
|
||||
};
|
||||
|
||||
var _default = wrapCell;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=wrapCell.js.map
|
35
node_modules/table/dist/wrapCell.js.flow
generated
vendored
Normal file
35
node_modules/table/dist/wrapCell.js.flow
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import wrapString from './wrapString';
|
||||
import wrapWord from './wrapWord';
|
||||
|
||||
/**
|
||||
* Wrap a single cell value into a list of lines
|
||||
*
|
||||
* Always wraps on newlines, for the remainder uses either word or string wrapping
|
||||
* depending on user configuration.
|
||||
*
|
||||
* @param {string} cellValue
|
||||
* @param {number} columnWidth
|
||||
* @param {boolean} useWrapWord
|
||||
* @returns {Array}
|
||||
*/
|
||||
export default (cellValue, columnWidth, useWrapWord) => {
|
||||
// First split on literal newlines
|
||||
const cellLines = cellValue.split('\n');
|
||||
|
||||
// Then iterate over the list and word-wrap every remaining line if necessary.
|
||||
for (let lineNr = 0; lineNr < cellLines.length;) {
|
||||
let lineChunks;
|
||||
|
||||
if (useWrapWord) {
|
||||
lineChunks = wrapWord(cellLines[lineNr], columnWidth);
|
||||
} else {
|
||||
lineChunks = wrapString(cellLines[lineNr], columnWidth);
|
||||
}
|
||||
|
||||
// Replace our original array element with whatever the wrapping returned
|
||||
cellLines.splice(lineNr, 1, ...lineChunks);
|
||||
lineNr += lineChunks.length;
|
||||
}
|
||||
|
||||
return cellLines;
|
||||
};
|
1
node_modules/table/dist/wrapCell.js.map
generated
vendored
Normal file
1
node_modules/table/dist/wrapCell.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/wrapCell.js"],"names":["cellValue","columnWidth","useWrapWord","cellLines","split","lineNr","length","lineChunks","splice"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;;;;;;;kBAWgBA,S,EAAWC,W,EAAaC,W,KAAgB;AACtD;AACA,QAAMC,SAAS,GAAGH,SAAS,CAACI,KAAV,CAAgB,IAAhB,CAAlB,CAFsD,CAItD;;AACA,OAAK,IAAIC,MAAM,GAAG,CAAlB,EAAqBA,MAAM,GAAGF,SAAS,CAACG,MAAxC,GAAiD;AAC/C,QAAIC,UAAJ;;AAEA,QAAIL,WAAJ,EAAiB;AACfK,MAAAA,UAAU,GAAG,uBAASJ,SAAS,CAACE,MAAD,CAAlB,EAA4BJ,WAA5B,CAAb;AACD,KAFD,MAEO;AACLM,MAAAA,UAAU,GAAG,yBAAWJ,SAAS,CAACE,MAAD,CAApB,EAA8BJ,WAA9B,CAAb;AACD,KAP8C,CAS/C;;;AACAE,IAAAA,SAAS,CAACK,MAAV,CAAiBH,MAAjB,EAAyB,CAAzB,EAA4B,GAAGE,UAA/B;AACAF,IAAAA,MAAM,IAAIE,UAAU,CAACD,MAArB;AACD;;AAED,SAAOH,SAAP;AACD,C","sourcesContent":["import wrapString from './wrapString';\nimport wrapWord from './wrapWord';\n\n/**\n * Wrap a single cell value into a list of lines\n *\n * Always wraps on newlines, for the remainder uses either word or string wrapping\n * depending on user configuration.\n *\n * @param {string} cellValue\n * @param {number} columnWidth\n * @param {boolean} useWrapWord\n * @returns {Array}\n */\nexport default (cellValue, columnWidth, useWrapWord) => {\n // First split on literal newlines\n const cellLines = cellValue.split('\\n');\n\n // Then iterate over the list and word-wrap every remaining line if necessary.\n for (let lineNr = 0; lineNr < cellLines.length;) {\n let lineChunks;\n\n if (useWrapWord) {\n lineChunks = wrapWord(cellLines[lineNr], columnWidth);\n } else {\n lineChunks = wrapString(cellLines[lineNr], columnWidth);\n }\n\n // Replace our original array element with whatever the wrapping returned\n cellLines.splice(lineNr, 1, ...lineChunks);\n lineNr += lineChunks.length;\n }\n\n return cellLines;\n};\n"],"file":"wrapCell.js"}
|
40
node_modules/table/dist/wrapString.js
generated
vendored
Normal file
40
node_modules/table/dist/wrapString.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _sliceAnsi = _interopRequireDefault(require("slice-ansi"));
|
||||
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Creates an array of strings split into groups the length of size.
|
||||
* This function works with strings that contain ASCII characters.
|
||||
*
|
||||
* wrapText is different from would-be "chunk" implementation
|
||||
* in that whitespace characters that occur on a chunk size limit are trimmed.
|
||||
*
|
||||
* @param {string} subject
|
||||
* @param {number} size
|
||||
* @returns {Array}
|
||||
*/
|
||||
const wrapString = (subject, size) => {
|
||||
let subjectSlice;
|
||||
subjectSlice = subject;
|
||||
const chunks = [];
|
||||
|
||||
do {
|
||||
chunks.push((0, _sliceAnsi.default)(subjectSlice, 0, size));
|
||||
subjectSlice = (0, _sliceAnsi.default)(subjectSlice, size).trim();
|
||||
} while ((0, _stringWidth.default)(subjectSlice));
|
||||
|
||||
return chunks;
|
||||
};
|
||||
|
||||
var _default = wrapString;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=wrapString.js.map
|
29
node_modules/table/dist/wrapString.js.flow
generated
vendored
Normal file
29
node_modules/table/dist/wrapString.js.flow
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import slice from 'slice-ansi';
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
/**
|
||||
* Creates an array of strings split into groups the length of size.
|
||||
* This function works with strings that contain ASCII characters.
|
||||
*
|
||||
* wrapText is different from would-be "chunk" implementation
|
||||
* in that whitespace characters that occur on a chunk size limit are trimmed.
|
||||
*
|
||||
* @param {string} subject
|
||||
* @param {number} size
|
||||
* @returns {Array}
|
||||
*/
|
||||
export default (subject, size) => {
|
||||
let subjectSlice;
|
||||
|
||||
subjectSlice = subject;
|
||||
|
||||
const chunks = [];
|
||||
|
||||
do {
|
||||
chunks.push(slice(subjectSlice, 0, size));
|
||||
|
||||
subjectSlice = slice(subjectSlice, size).trim();
|
||||
} while (stringWidth(subjectSlice));
|
||||
|
||||
return chunks;
|
||||
};
|
1
node_modules/table/dist/wrapString.js.map
generated
vendored
Normal file
1
node_modules/table/dist/wrapString.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/wrapString.js"],"names":["subject","size","subjectSlice","chunks","push","trim"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;;;;;;;oBAWgBA,O,EAASC,I,KAAS;AAChC,MAAIC,YAAJ;AAEAA,EAAAA,YAAY,GAAGF,OAAf;AAEA,QAAMG,MAAM,GAAG,EAAf;;AAEA,KAAG;AACDA,IAAAA,MAAM,CAACC,IAAP,CAAY,wBAAMF,YAAN,EAAoB,CAApB,EAAuBD,IAAvB,CAAZ;AAEAC,IAAAA,YAAY,GAAG,wBAAMA,YAAN,EAAoBD,IAApB,EAA0BI,IAA1B,EAAf;AACD,GAJD,QAIS,0BAAYH,YAAZ,CAJT;;AAMA,SAAOC,MAAP;AACD,C","sourcesContent":["import slice from 'slice-ansi';\nimport stringWidth from 'string-width';\n\n/**\n * Creates an array of strings split into groups the length of size.\n * This function works with strings that contain ASCII characters.\n *\n * wrapText is different from would-be \"chunk\" implementation\n * in that whitespace characters that occur on a chunk size limit are trimmed.\n *\n * @param {string} subject\n * @param {number} size\n * @returns {Array}\n */\nexport default (subject, size) => {\n let subjectSlice;\n\n subjectSlice = subject;\n\n const chunks = [];\n\n do {\n chunks.push(slice(subjectSlice, 0, size));\n\n subjectSlice = slice(subjectSlice, size).trim();\n } while (stringWidth(subjectSlice));\n\n return chunks;\n};\n"],"file":"wrapString.js"}
|
47
node_modules/table/dist/wrapWord.js
generated
vendored
Normal file
47
node_modules/table/dist/wrapWord.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _sliceAnsi = _interopRequireDefault(require("slice-ansi"));
|
||||
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {number} size
|
||||
* @returns {Array}
|
||||
*/
|
||||
const wrapWord = (input, size) => {
|
||||
let subject;
|
||||
subject = input;
|
||||
const chunks = []; // https://regex101.com/r/gY5kZ1/1
|
||||
|
||||
const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))');
|
||||
|
||||
do {
|
||||
let chunk;
|
||||
chunk = subject.match(re);
|
||||
|
||||
if (chunk) {
|
||||
chunk = chunk[0];
|
||||
subject = (0, _sliceAnsi.default)(subject, (0, _stringWidth.default)(chunk));
|
||||
chunk = chunk.trim();
|
||||
} else {
|
||||
chunk = (0, _sliceAnsi.default)(subject, 0, size);
|
||||
subject = (0, _sliceAnsi.default)(subject, size);
|
||||
}
|
||||
|
||||
chunks.push(chunk);
|
||||
} while ((0, _stringWidth.default)(subject));
|
||||
|
||||
return chunks;
|
||||
};
|
||||
|
||||
var _default = wrapWord;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=wrapWord.js.map
|
39
node_modules/table/dist/wrapWord.js.flow
generated
vendored
Normal file
39
node_modules/table/dist/wrapWord.js.flow
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
import slice from 'slice-ansi';
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {number} size
|
||||
* @returns {Array}
|
||||
*/
|
||||
export default (input, size) => {
|
||||
let subject;
|
||||
|
||||
subject = input;
|
||||
|
||||
const chunks = [];
|
||||
|
||||
// https://regex101.com/r/gY5kZ1/1
|
||||
const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))');
|
||||
|
||||
do {
|
||||
let chunk;
|
||||
|
||||
chunk = subject.match(re);
|
||||
|
||||
if (chunk) {
|
||||
chunk = chunk[0];
|
||||
|
||||
subject = slice(subject, stringWidth(chunk));
|
||||
|
||||
chunk = chunk.trim();
|
||||
} else {
|
||||
chunk = slice(subject, 0, size);
|
||||
subject = slice(subject, size);
|
||||
}
|
||||
|
||||
chunks.push(chunk);
|
||||
} while (stringWidth(subject));
|
||||
|
||||
return chunks;
|
||||
};
|
1
node_modules/table/dist/wrapWord.js.map
generated
vendored
Normal file
1
node_modules/table/dist/wrapWord.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/wrapWord.js"],"names":["input","size","subject","chunks","re","RegExp","chunk","match","trim","push"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;kBAKgBA,K,EAAOC,I,KAAS;AAC9B,MAAIC,OAAJ;AAEAA,EAAAA,OAAO,GAAGF,KAAV;AAEA,QAAMG,MAAM,GAAG,EAAf,CAL8B,CAO9B;;AACA,QAAMC,EAAE,GAAG,IAAIC,MAAJ,CAAW,WAAWJ,IAAX,GAAkB,mBAAlB,IAAyCA,IAAI,GAAG,CAAhD,IAAqD,wBAAhE,CAAX;;AAEA,KAAG;AACD,QAAIK,KAAJ;AAEAA,IAAAA,KAAK,GAAGJ,OAAO,CAACK,KAAR,CAAcH,EAAd,CAAR;;AAEA,QAAIE,KAAJ,EAAW;AACTA,MAAAA,KAAK,GAAGA,KAAK,CAAC,CAAD,CAAb;AAEAJ,MAAAA,OAAO,GAAG,wBAAMA,OAAN,EAAe,0BAAYI,KAAZ,CAAf,CAAV;AAEAA,MAAAA,KAAK,GAAGA,KAAK,CAACE,IAAN,EAAR;AACD,KAND,MAMO;AACLF,MAAAA,KAAK,GAAG,wBAAMJ,OAAN,EAAe,CAAf,EAAkBD,IAAlB,CAAR;AACAC,MAAAA,OAAO,GAAG,wBAAMA,OAAN,EAAeD,IAAf,CAAV;AACD;;AAEDE,IAAAA,MAAM,CAACM,IAAP,CAAYH,KAAZ;AACD,GAjBD,QAiBS,0BAAYJ,OAAZ,CAjBT;;AAmBA,SAAOC,MAAP;AACD,C","sourcesContent":["import slice from 'slice-ansi';\nimport stringWidth from 'string-width';\n\n/**\n * @param {string} input\n * @param {number} size\n * @returns {Array}\n */\nexport default (input, size) => {\n let subject;\n\n subject = input;\n\n const chunks = [];\n\n // https://regex101.com/r/gY5kZ1/1\n const re = new RegExp('(^.{1,' + size + '}(\\\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\\\\\|/|_|\\\\.|,|;|-))');\n\n do {\n let chunk;\n\n chunk = subject.match(re);\n\n if (chunk) {\n chunk = chunk[0];\n\n subject = slice(subject, stringWidth(chunk));\n\n chunk = chunk.trim();\n } else {\n chunk = slice(subject, 0, size);\n subject = slice(subject, size);\n }\n\n chunks.push(chunk);\n } while (stringWidth(subject));\n\n return chunks;\n};\n"],"file":"wrapWord.js"}
|
14
node_modules/table/node_modules/ansi-regex/index.js
generated
vendored
Normal file
14
node_modules/table/node_modules/ansi-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = options => {
|
||||
options = Object.assign({
|
||||
onlyFirst: false
|
||||
}, options);
|
||||
|
||||
const pattern = [
|
||||
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
||||
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
||||
].join('|');
|
||||
|
||||
return new RegExp(pattern, options.onlyFirst ? undefined : 'g');
|
||||
};
|
9
node_modules/table/node_modules/ansi-regex/license
generated
vendored
Normal file
9
node_modules/table/node_modules/ansi-regex/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
85
node_modules/table/node_modules/ansi-regex/package.json
generated
vendored
Normal file
85
node_modules/table/node_modules/ansi-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"_from": "ansi-regex@^4.1.0",
|
||||
"_id": "ansi-regex@4.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"_location": "/table/ansi-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ansi-regex@^4.1.0",
|
||||
"name": "ansi-regex",
|
||||
"escapedName": "ansi-regex",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/table/strip-ansi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"_shasum": "8b9f8f08cf1acb843756a839ca8c7e3168c51997",
|
||||
"_spec": "ansi-regex@^4.1.0",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/table/node_modules/strip-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"devDependencies": {
|
||||
"ava": "^0.25.0",
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/chalk/ansi-regex#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "ansi-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava",
|
||||
"view-supported": "node fixtures/view-codes.js"
|
||||
},
|
||||
"version": "4.1.0"
|
||||
}
|
87
node_modules/table/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
87
node_modules/table/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
# ansi-regex [](https://travis-ci.org/chalk/ansi-regex)
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||
//=> ['\u001B[4m', '\u001B[0m']
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||
//=> ['\u001B[4m']
|
||||
|
||||
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### ansiRegex([options])
|
||||
|
||||
Returns a regex for matching ANSI escape codes.
|
||||
|
||||
#### options
|
||||
|
||||
##### onlyFirst
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false` *(Matches any ANSI escape codes in a string)*
|
||||
|
||||
Match only the first ANSI escape.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why do you test for codes not in the ECMA 48 standard?
|
||||
|
||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||
|
||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
20
node_modules/table/node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/table/node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
73
node_modules/table/node_modules/emoji-regex/README.md
generated
vendored
Normal file
73
node_modules/table/node_modules/emoji-regex/README.md
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
# emoji-regex [](https://travis-ci.org/mathiasbynens/emoji-regex)
|
||||
|
||||
_emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard.
|
||||
|
||||
This repository contains a script that generates this regular expression based on [the data from Unicode Technical Report #51](https://github.com/mathiasbynens/unicode-tr51). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard.
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install emoji-regex
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex');
|
||||
// Note: because the regular expression has the global flag set, this module
|
||||
// exports a function that returns the regex rather than exporting the regular
|
||||
// expression itself, to make it impossible to (accidentally) mutate the
|
||||
// original regular expression.
|
||||
|
||||
const text = `
|
||||
\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
|
||||
\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
|
||||
\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
|
||||
\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
|
||||
`;
|
||||
|
||||
const regex = emojiRegex();
|
||||
let match;
|
||||
while (match = regex.exec(text)) {
|
||||
const emoji = match[0];
|
||||
console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
|
||||
}
|
||||
```
|
||||
|
||||
Console output:
|
||||
|
||||
```
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
```
|
||||
|
||||
To match emoji in their textual representation as well (i.e. emoji that are not `Emoji_Presentation` symbols and that aren’t forced to render as emoji by a variation selector), `require` the other regex:
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex/text.js');
|
||||
```
|
||||
|
||||
Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes:
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex/es2015/index.js');
|
||||
const emojiRegexText = require('emoji-regex/es2015/text.js');
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
_emoji-regex_ is available under the [MIT](https://mths.be/mit) license.
|
6
node_modules/table/node_modules/emoji-regex/es2015/index.js
generated
vendored
Normal file
6
node_modules/table/node_modules/emoji-regex/es2015/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/table/node_modules/emoji-regex/es2015/text.js
generated
vendored
Normal file
6
node_modules/table/node_modules/emoji-regex/es2015/text.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
node_modules/table/node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
5
node_modules/table/node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
declare module 'emoji-regex' {
|
||||
function emojiRegex(): RegExp;
|
||||
|
||||
export default emojiRegex;
|
||||
}
|
6
node_modules/table/node_modules/emoji-regex/index.js
generated
vendored
Normal file
6
node_modules/table/node_modules/emoji-regex/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
78
node_modules/table/node_modules/emoji-regex/package.json
generated
vendored
Normal file
78
node_modules/table/node_modules/emoji-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"_from": "emoji-regex@^7.0.1",
|
||||
"_id": "emoji-regex@7.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||
"_location": "/table/emoji-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "emoji-regex@^7.0.1",
|
||||
"name": "emoji-regex",
|
||||
"escapedName": "emoji-regex",
|
||||
"rawSpec": "^7.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/table/string-width"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||
"_shasum": "933a04052860c85e83c122479c4748a8e4c72156",
|
||||
"_spec": "emoji-regex@^7.0.1",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/table/node_modules/string-width",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mathiasbynens/emoji-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-proposal-unicode-property-regex": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"mocha": "^5.2.0",
|
||||
"regexgen": "^1.3.0",
|
||||
"unicode-11.0.0": "^0.7.7",
|
||||
"unicode-tr51": "^9.0.1"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"text.js",
|
||||
"es2015/index.js",
|
||||
"es2015/text.js"
|
||||
],
|
||||
"homepage": "https://mths.be/emoji-regex",
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular expressions",
|
||||
"code points",
|
||||
"symbols",
|
||||
"characters",
|
||||
"emoji"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "emoji-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mathiasbynens/emoji-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js",
|
||||
"test": "mocha",
|
||||
"test:watch": "npm run test -- --watch"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "7.0.3"
|
||||
}
|
6
node_modules/table/node_modules/emoji-regex/text.js
generated
vendored
Normal file
6
node_modules/table/node_modules/emoji-regex/text.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
39
node_modules/table/node_modules/string-width/index.js
generated
vendored
Normal file
39
node_modules/table/node_modules/string-width/index.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
const stripAnsi = require('strip-ansi');
|
||||
const isFullwidthCodePoint = require('is-fullwidth-code-point');
|
||||
const emojiRegex = require('emoji-regex')();
|
||||
|
||||
module.exports = input => {
|
||||
input = input.replace(emojiRegex, ' ');
|
||||
|
||||
if (typeof input !== 'string' || input.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
input = stripAnsi(input);
|
||||
|
||||
let width = 0;
|
||||
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
const code = input.codePointAt(i);
|
||||
|
||||
// Ignore control characters
|
||||
if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore combining characters
|
||||
if (code >= 0x300 && code <= 0x36F) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Surrogates
|
||||
if (code > 0xFFFF) {
|
||||
i++;
|
||||
}
|
||||
|
||||
width += isFullwidthCodePoint(code) ? 2 : 1;
|
||||
}
|
||||
|
||||
return width;
|
||||
};
|
9
node_modules/table/node_modules/string-width/license
generated
vendored
Normal file
9
node_modules/table/node_modules/string-width/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
88
node_modules/table/node_modules/string-width/package.json
generated
vendored
Normal file
88
node_modules/table/node_modules/string-width/package.json
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"_from": "string-width@^3.0.0",
|
||||
"_id": "string-width@3.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
|
||||
"_location": "/table/string-width",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "string-width@^3.0.0",
|
||||
"name": "string-width",
|
||||
"escapedName": "string-width",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/table"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
||||
"_shasum": "22767be21b62af1081574306f69ac51b62203961",
|
||||
"_spec": "string-width@^3.0.0",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/table",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/string-width/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"emoji-regex": "^7.0.1",
|
||||
"is-fullwidth-code-point": "^2.0.0",
|
||||
"strip-ansi": "^5.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get the visual width of a string - the number of columns required to display it",
|
||||
"devDependencies": {
|
||||
"ava": "^1.0.1",
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/string-width#readme",
|
||||
"keywords": [
|
||||
"string",
|
||||
"str",
|
||||
"character",
|
||||
"char",
|
||||
"unicode",
|
||||
"width",
|
||||
"visual",
|
||||
"column",
|
||||
"columns",
|
||||
"fullwidth",
|
||||
"full-width",
|
||||
"full",
|
||||
"ansi",
|
||||
"escape",
|
||||
"codes",
|
||||
"cli",
|
||||
"command-line",
|
||||
"terminal",
|
||||
"console",
|
||||
"cjk",
|
||||
"chinese",
|
||||
"japanese",
|
||||
"korean",
|
||||
"fixed-width"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "string-width",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/string-width.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "3.1.0"
|
||||
}
|
45
node_modules/table/node_modules/string-width/readme.md
generated
vendored
Normal file
45
node_modules/table/node_modules/string-width/readme.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
# string-width [](https://travis-ci.org/sindresorhus/string-width)
|
||||
|
||||
> Get the visual width of a string - the number of columns required to display it
|
||||
|
||||
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
||||
|
||||
Useful to be able to measure the actual width of command-line output.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install string-width
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const stringWidth = require('string-width');
|
||||
|
||||
stringWidth('古');
|
||||
//=> 2
|
||||
|
||||
stringWidth('\u001b[1m古\u001b[22m');
|
||||
//=> 2
|
||||
|
||||
stringWidth('a');
|
||||
//=> 1
|
||||
|
||||
stringWidth('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
||||
// => 5
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
|
||||
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
|
||||
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
15
node_modules/table/node_modules/strip-ansi/index.d.ts
generated
vendored
Normal file
15
node_modules/table/node_modules/strip-ansi/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
|
||||
|
||||
@example
|
||||
```
|
||||
import stripAnsi from 'strip-ansi';
|
||||
|
||||
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
||||
//=> 'Unicorn'
|
||||
|
||||
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
||||
//=> 'Click'
|
||||
```
|
||||
*/
|
||||
export default function stripAnsi(string: string): string;
|
7
node_modules/table/node_modules/strip-ansi/index.js
generated
vendored
Normal file
7
node_modules/table/node_modules/strip-ansi/index.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
const ansiRegex = require('ansi-regex');
|
||||
|
||||
const stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
|
||||
|
||||
module.exports = stripAnsi;
|
||||
module.exports.default = stripAnsi;
|
9
node_modules/table/node_modules/strip-ansi/license
generated
vendored
Normal file
9
node_modules/table/node_modules/strip-ansi/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
86
node_modules/table/node_modules/strip-ansi/package.json
generated
vendored
Normal file
86
node_modules/table/node_modules/strip-ansi/package.json
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"_from": "strip-ansi@^5.1.0",
|
||||
"_id": "strip-ansi@5.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"_location": "/table/strip-ansi",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "strip-ansi@^5.1.0",
|
||||
"name": "strip-ansi",
|
||||
"escapedName": "strip-ansi",
|
||||
"rawSpec": "^5.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/table/string-width"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"_shasum": "8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae",
|
||||
"_spec": "strip-ansi@^5.1.0",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/table/node_modules/string-width",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/strip-ansi/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Strip ANSI escape codes from a string",
|
||||
"devDependencies": {
|
||||
"ava": "^1.3.1",
|
||||
"tsd-check": "^0.5.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/chalk/strip-ansi#readme",
|
||||
"keywords": [
|
||||
"strip",
|
||||
"trim",
|
||||
"remove",
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "strip-ansi",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/strip-ansi.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd-check"
|
||||
},
|
||||
"version": "5.2.0"
|
||||
}
|
61
node_modules/table/node_modules/strip-ansi/readme.md
generated
vendored
Normal file
61
node_modules/table/node_modules/strip-ansi/readme.md
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
# strip-ansi [](https://travis-ci.org/chalk/strip-ansi)
|
||||
|
||||
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=readme">Get professional support for 'strip-ansi' with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install strip-ansi
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const stripAnsi = require('strip-ansi');
|
||||
|
||||
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
||||
//=> 'Unicorn'
|
||||
|
||||
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
||||
//=> 'Click'
|
||||
```
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
115
node_modules/table/package.json
generated
vendored
Normal file
115
node_modules/table/package.json
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
{
|
||||
"_from": "table@^5.2.3",
|
||||
"_id": "table@5.4.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==",
|
||||
"_location": "/table",
|
||||
"_phantomChildren": {
|
||||
"is-fullwidth-code-point": "2.0.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "table@^5.2.3",
|
||||
"name": "table",
|
||||
"escapedName": "table",
|
||||
"rawSpec": "^5.2.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.2.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/eslint"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
|
||||
"_shasum": "1292d19500ce3f86053b05f0e8e7e4a3bb21079e",
|
||||
"_spec": "table@^5.2.3",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/eslint",
|
||||
"author": {
|
||||
"name": "Gajus Kuizinas",
|
||||
"email": "gajus@gajus.com",
|
||||
"url": "http://gajus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/gajus/table/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"ajv": "^6.10.2",
|
||||
"lodash": "^4.17.14",
|
||||
"slice-ansi": "^2.1.0",
|
||||
"string-width": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Formats data into a string table.",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.5.0",
|
||||
"@babel/core": "^7.5.4",
|
||||
"@babel/node": "^7.5.0",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
|
||||
"@babel/preset-env": "^7.5.4",
|
||||
"@babel/register": "^7.4.4",
|
||||
"ajv-cli": "^3.0.0",
|
||||
"ajv-keywords": "^3.4.1",
|
||||
"babel-plugin-istanbul": "^5.1.4",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"babel-plugin-transform-export-default-name": "^2.0.4",
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^2.4.2",
|
||||
"coveralls": "^3.0.5",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint-config-canonical": "^16.1.0",
|
||||
"flow-bin": "^0.102.0",
|
||||
"flow-copy-source": "^2.0.7",
|
||||
"gitdown": "^3.1.1",
|
||||
"husky": "^3.0.0",
|
||||
"mocha": "^6.1.4",
|
||||
"nyc": "^14.1.1",
|
||||
"semantic-release": "^15.13.18",
|
||||
"sinon": "^7.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/gajus/table#readme",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"post-commit": "npm run create-readme && git add README.md && git commit -m 'docs: generate docs' --no-verify",
|
||||
"pre-commit": "npm run lint && npm run test && npm run build"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"ascii",
|
||||
"text",
|
||||
"table",
|
||||
"align",
|
||||
"ansi"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "./dist/index.js",
|
||||
"name": "table",
|
||||
"nyc": {
|
||||
"include": [
|
||||
"src/**/*.js"
|
||||
],
|
||||
"instrument": false,
|
||||
"reporter": [
|
||||
"text-lcov"
|
||||
],
|
||||
"require": [
|
||||
"@babel/register"
|
||||
],
|
||||
"sourceMap": false
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/gajus/table.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && npm run create-validators && flow-copy-source src dist",
|
||||
"create-readme": "gitdown ./.README/README.md --output-file ./README.md",
|
||||
"create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -c ajv-keywords/keywords/typeof -o dist/validateConfig.js && ajv compile --all-errors --inline-refs=false -s src/schemas/streamConfig -c ajv-keywords/keywords/typeof -o dist/validateStreamConfig.js",
|
||||
"lint": "npm run build && eslint ./src ./test && flow",
|
||||
"test": "mocha --require @babel/register"
|
||||
},
|
||||
"version": "5.4.6"
|
||||
}
|
Reference in New Issue
Block a user