MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / duplicateColumn

Function duplicateColumn

packages/app-core/src/lib/markdown-table.ts:342–352  ·  view source on GitHub ↗
(
  table: MarkdownTable,
  index: number
)

Source from the content-addressed store, hash-verified

340}
341
342export function duplicateColumn(
343 table: MarkdownTable,
344 index: number
345): MarkdownTable {
346 if (index < 0 || index >= columnCount(table)) return table
347 const next = clone(table)
348 next.headers.splice(index + 1, 0, next.headers[index])
349 next.aligns.splice(index + 1, 0, next.aligns[index])
350 for (const row of next.rows) row.splice(index + 1, 0, row[index])
351 return next
352}
353
354export function moveColumn(
355 table: MarkdownTable,

Callers 2

openTableContextMenuFunction · 0.90

Calls 2

columnCountFunction · 0.85
cloneFunction · 0.85

Tested by

no test coverage detected