Permalink
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/table/dist/drawContent.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
26 lines (26 sloc)
996 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.drawContent = void 0; | |
/** | |
* Shared function to draw horizontal borders, rows or the entire table | |
*/ | |
const drawContent = (contents, separatorConfig) => { | |
const { separatorGetter, drawSeparator } = separatorConfig; | |
const contentSize = contents.length; | |
const result = []; | |
if (drawSeparator(0, contentSize)) { | |
result.push(separatorGetter(0, contentSize)); | |
} | |
contents.forEach((content, contentIndex) => { | |
result.push(content); | |
// Only append the middle separator if the content is not the last | |
if (contentIndex + 1 < contentSize && drawSeparator(contentIndex + 1, contentSize)) { | |
result.push(separatorGetter(contentIndex + 1, contentSize)); | |
} | |
}); | |
if (drawSeparator(contentSize, contentSize)) { | |
result.push(separatorGetter(contentSize, contentSize)); | |
} | |
return result.join(''); | |
}; | |
exports.drawContent = drawContent; |