You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of isEqual is bad. It only looks at keys of a and ignores the keys of b.
Lib version: 4.3.0
Steps To Reproduce
I was exporting an xlsx and I noticed that a column was interpreting numbers as dates. I discovered that the toModel method in column.js merges the column with the previous column because the column has an empty style. This causes column.equivalentTo(col) to return true at this line: https://github.com/exceljs/exceljs/blob/master/lib/doc/column.js#L275.
The check boils down to: _.isEqual(this.style, other.style). In my case, this.style is empty, so it can be written as: _.isEqual({}, {...}). isEqual will enumerate the keys of the first argument, which is empty, so it doesn't actually check any key.
Possible solution (optional, but very helpful):
Check that the keys match before iterating on a.
The text was updated successfully, but these errors were encountered:
Also, I don't get why you got rid of lodash. You still depend on it indirectly:
$ yarn why lodash.isequal
yarn why v1.22.11
[1/4] Why do we have the module "lodash.isequal"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "lodash.isequal@4.5.0"
info Reasons this module exists
- "exceljs#fast-csv#@fast-csv#format" depends on it
- Hoisted from "exceljs#fast-csv#@fast-csv#format#lodash.isequal"
info Disk size without dependencies: "64KB"
info Disk size with unique dependencies: "64KB"
info Disk size with transitive dependencies: "64KB"
info Number of shared dependencies: 0
Done in 0.09s.
🐛 Bug Report
The implementation of
isEqual
is bad. It only looks at keys ofa
and ignores the keys ofb
.Lib version: 4.3.0
Steps To Reproduce
I was exporting an xlsx and I noticed that a column was interpreting numbers as dates. I discovered that the
toModel
method incolumn.js
merges the column with the previous column because the column has an empty style. This causescolumn.equivalentTo(col)
to return true at this line: https://github.com/exceljs/exceljs/blob/master/lib/doc/column.js#L275.The check boils down to:
_.isEqual(this.style, other.style)
. In my case,this.style
is empty, so it can be written as:_.isEqual({}, {...})
.isEqual
will enumerate the keys of the first argument, which is empty, so it doesn't actually check any key.Possible solution (optional, but very helpful):
Check that the keys match before iterating on
a
.The text was updated successfully, but these errors were encountered: