Skip to content

Commit 74c9445

Browse files
committed
Use Object.create(null)
1 parent b1e810b commit 74c9445

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/xlsx.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ function extract(sheet, {range, headers} = {}) {
3434

3535
const output = new Array(r1 - r0 + 1);
3636
for (let r = r0; r <= r1; r++) {
37-
// Should we be using Object.create(null) instead of an empty object here?
38-
const row = (output[r - r0] = Object.defineProperty({}, "#", { // what is this non-enumerable row["#"] property for?
39-
value: r + 1,
40-
}));
37+
const row = (output[r - r0] = Object.create(null, {"#": {value: r + 1}}));
4138
const _row = sheet._rows[r]; // is this an internal ExcelJS API? why not sheet.getRow(r)?
4239
if (_row && _row.hasValues)
4340
for (let c = c0; c <= c1; c++) {

0 commit comments

Comments
 (0)