(index: number)
| 11 | * @returns {string} |
| 12 | */ |
| 13 | export function spreadsheetColumnLabel(index: number): string { |
| 14 | let dividend = index + 1; |
| 15 | let columnLabel = ''; |
| 16 | let modulo; |
| 17 | |
| 18 | while (dividend > 0) { |
| 19 | modulo = (dividend - 1) % COLUMN_LABEL_BASE_LENGTH; |
| 20 | columnLabel = String.fromCharCode(65 + modulo) + columnLabel; |
| 21 | dividend = parseInt(String((dividend - modulo) / COLUMN_LABEL_BASE_LENGTH), 10); |
| 22 | } |
| 23 | |
| 24 | return columnLabel; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Generates spreadsheet-like column index from theirs labels: A, B, C ...., Z, AA, AB, etc. |
no outgoing calls
no test coverage detected
searching dependent graphs…