MCPcopy Create free account
hub / github.com/cli-table/cli-table3 / drawTop

Method drawTop

src/cell.js:166–182  ·  view source on GitHub ↗

* Renders the top line of the cell. * @param drawRight - true if this method should render the right edge of the cell. * @returns {String}

(drawRight)

Source from the content-addressed store, hash-verified

164 * @returns {String}
165 */
166 drawTop(drawRight) {
167 let content = [];
168 if (this.cells) {
169 //TODO: cells should always exist - some tests don't fill it in though
170 this.widths.forEach(function (width, index) {
171 content.push(this._topLeftChar(index));
172 content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], width));
173 }, this);
174 } else {
175 content.push(this._topLeftChar(0));
176 content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], this.width));
177 }
178 if (drawRight) {
179 content.push(this.chars[this.y == 0 ? 'topRight' : 'rightMid']);
180 }
181 return this.wrapWithStyleColors('border', content.join(''));
182 }
183
184 _topLeftChar(offset) {
185 let x = this.x + offset;

Callers 1

drawMethod · 0.95

Calls 2

_topLeftCharMethod · 0.95
wrapWithStyleColorsMethod · 0.95

Tested by

no test coverage detected