Files
react-native-devtools-frontend/node_modules/table/dist/drawBorder.js
T
Tim van der Lippe 382089011b Run npm audit
This syncs our dependencies to the latest version. There is still
a reported vulnerability in postcss, but we are luckily unaffected.
However, we can't upgrade postcss yet, as stylelint requires it
and can not use postcss 8 yet:
https://github.com/stylelint/stylelint/issues/4942#issuecomment-823513767

Also updated manage_node_deps.py to not run the full install when
running `ls`, to allow for easier inspection of our dependency graph.

R=jacktfranklin@chromium.org

Bug: none
Change-Id: I1c9e4836fca25500e2e7277ec82b13bf2b881dca
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2887731
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-11 16:18:42 +00:00

101 lines
3.2 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = exports.createTableBorderGetter = void 0;
const drawContent_1 = require("./drawContent");
const drawBorder = (columnWidths, config) => {
const { separator, drawVerticalLine } = config;
const columns = columnWidths.map((size) => {
return config.separator.body.repeat(size);
});
return drawContent_1.drawContent(columns, {
drawSeparator: drawVerticalLine,
separatorGetter: (index, columnCount) => {
if (index === 0) {
return separator.left;
}
if (index === columnCount) {
return separator.right;
}
return separator.join;
},
}) + '\n';
};
exports.drawBorder = drawBorder;
const drawBorderTop = (columnWidths, config) => {
const result = drawBorder(columnWidths, {
...config,
separator: {
body: config.border.topBody,
join: config.border.topJoin,
left: config.border.topLeft,
right: config.border.topRight,
},
});
if (result === '\n') {
return '';
}
return result;
};
exports.drawBorderTop = drawBorderTop;
const drawBorderJoin = (columnWidths, config) => {
return drawBorder(columnWidths, {
...config,
separator: {
body: config.border.joinBody,
join: config.border.joinJoin,
left: config.border.joinLeft,
right: config.border.joinRight,
},
});
};
exports.drawBorderJoin = drawBorderJoin;
const drawBorderBottom = (columnWidths, config) => {
return drawBorder(columnWidths, {
...config,
separator: {
body: config.border.bottomBody,
join: config.border.bottomJoin,
left: config.border.bottomLeft,
right: config.border.bottomRight,
},
});
};
exports.drawBorderBottom = drawBorderBottom;
const createTableBorderGetter = (columnWidths, config) => {
return (index, size) => {
if (!config.header) {
if (index === 0) {
return drawBorderTop(columnWidths, config);
}
if (index === size) {
return drawBorderBottom(columnWidths, config);
}
return drawBorderJoin(columnWidths, config);
}
// Deal with the header
if (index === 0) {
return drawBorderTop(columnWidths, {
...config,
border: {
...config.border,
topJoin: config.border.topBody,
},
});
}
if (index === 1) {
return drawBorderJoin(columnWidths, {
...config,
border: {
...config.border,
joinJoin: config.border.headerJoin,
},
});
}
if (index === size) {
return drawBorderBottom(columnWidths, config);
}
return drawBorderJoin(columnWidths, config);
};
};
exports.createTableBorderGetter = createTableBorderGetter;