exceljs / exceljs/exceljs

Misshandling of value 0 (zero) in copy operation in `FormulaValue`

Open
#2,943 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

The line:

https://github.com/exceljs/exceljs/blob/5bed18b45e824f409b08456b59b87430ded023ab/lib/doc/cell.js#L753

which is part of the code:
```
_copyModel(model) {
const copy = {};
const cp = name => {
const value = model[name];
if (value) {
copy[name] = value;
}
};
cp('formula');
cp('result');
cp('ref');
cp('shareType');
cp('sharedFormula');
return copy;
}
```

incorrectly handles the values of `0`, `false`, and any other possibly falsy value of `result`, becuase it skips the copy operation, due to `if (value)` being false for those values... this in turn produces an incomplete copy of FormulaValue, which makes `Cell.value` return incomplete values.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.