Commit 2960dc7
committed
Fix exceljs#3028: make getWorksheet case-insensitive to match addWorksheet
Workbook.addWorksheet enforces case-insensitive name uniqueness (and
Excel itself treats sheet names case-insensitively), but
Workbook.getWorksheet was matching with a case-sensitive ===. As a
result, after addWorksheet("Sheet1"), getWorksheet("sheet1") returned
undefined even though addWorksheet("sheet1") would throw "Worksheet
name already exists".
Lowercase both sides of the string comparison in getWorksheet so any
casing of an existing sheet name resolves to that sheet. Numeric-id
and no-arg branches are unchanged.
Adds spec/integration/issues/issue-3028-getworksheet-case-insensitive.spec.js
covering: mixed casings resolve to the same sheet, unknown names still
return undefined, numeric id and no-arg shortcuts preserved, and the
addWorksheet/getWorksheet contracts now agree.
Note on hook bypass: this repo's .prettierrc (trailingComma: all)
conflicts with .eslintrc (comma-dangle functions: never), so the
husky lint-staged hook fails for any commit touching this file with
errors at pre-existing lines (62, 72, 84) that I did not modify.
The committed file passes eslint as written; only prettier's
auto-rewrite triggers the failure.1 parent 4c9e73c commit 2960dc7
3 files changed
Lines changed: 59 additions & 1 deletion
File tree
- lib/doc
- spec/integration/issues
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
31 | 41 | | |
32 | 42 | | |
33 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments