sheet_to_json: rawNumber applied only when raw: true #2978

Closed
opened 2023-08-27 05:22:22 +00:00 by JulitorK · 2 comments
Contributor

I wanted to ask if this is expected behaviour:
485a4f30f1/bits/90_utils.js (L42)

row[hdr[C]] = raw && (val.t !== "n" || (val.t === "n" && o.rawNumbers !== false)) ? v : format_cell(val,v,o);

For now there is no way to apply rawNumber, if my parsing option is raw:false.

In the end result I would like to have all field types formatted except for numbers (because of e-notation), hence I want raw:false and assumed rawNumbers provide that exclusion.

I also noticed that previous commit to that line allowed it, so maybe there's some edge case I'm not seeing? Here's the previous version:
row[hdr[C]] = raw || (o.rawNumbers && val.t == "n") ? v : format_cell(val,v,o);

I wanted to ask if this is expected behaviour: https://git.sheetjs.com/sheetjs/sheetjs/src/commit/485a4f30f17ee6e2d79680133251f0dbfff74c6d/bits/90_utils.js#L42 `row[hdr[C]] = raw && (val.t !== "n" || (val.t === "n" && o.rawNumbers !== false)) ? v : format_cell(val,v,o);` For now there is no way to apply `rawNumber`, if my parsing option is `raw:false`. In the end result I would like to have all field types formatted except for numbers (because of e-notation), hence I want `raw:false` and assumed `rawNumbers` provide that exclusion. I also noticed that previous commit to that line allowed it, so maybe there's some edge case I'm not seeing? Here's the previous version: `row[hdr[C]] = raw || (o.rawNumbers && val.t == "n") ? v : format_cell(val,v,o);`
Author
Contributor

Opened #2979 to solve this

Opened #2979 to solve this
Owner

Closed in 766fc4f4d2

Closed in 766fc4f4d20c292e59705358a7c4d42ab7388429
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2978
No description provided.