MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / split

Function split

script/check-md-table-padding.ts:50–73  ·  view source on GitHub ↗
(row: string)

Source from the content-addressed store, hash-verified

48type Issue = { file: string; line: number; kind: 'separator' | 'content'; detail: string };
49
50function split(row: string) {
51 // Split on unescaped pipes, drop the empty leading/trailing cells that come
52 // from rows starting and ending with a pipe.
53 const cells: string[] = [];
54 let buf = '';
55 for (let i = 0; i < row.length; i++) {
56 const c = row[i];
57 if (c === '\\' && row[i + 1] === '|') {
58 buf += '\\|';
59 i++;
60 continue;
61 }
62 if (c === '|') {
63 cells.push(buf);
64 buf = '';
65 continue;
66 }
67 buf += c;
68 }
69 cells.push(buf);
70 if (cells.length >= 2 && cells[0].trim() === '') cells.shift();
71 if (cells.length >= 1 && cells[cells.length - 1].trim() === '') cells.pop();
72 return cells;
73}
74
75function isSep(row: string) {
76 // A separator row contains only pipes, dashes, colons, and spaces, and has

Callers 2

checkFunction · 0.85
rewriteRowFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected