Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff813aa

Browse files
authored
Merge pull request #906 from sophiedophie/bugfix/exclude-infinity-from-number
Exclude Infinity on createInputStream
2 parents 12cb4e7 + 138a949 commit ff813aa

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

lib/csv/csv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ CSV.prototype = {
6060
return null;
6161
}
6262
const datumNumber = Number(datum);
63-
if (!Number.isNaN(datumNumber)) {
63+
if (!Number.isNaN(datumNumber) && datumNumber !== Infinity) {
6464
return datumNumber;
6565
}
6666
const dt = dayjs(datum, dateFormats, true);

spec/unit/xlsx/xform/sheet/cell-xform.spec.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,38 @@ const expectations = [
9999
tests: ['prepare', 'render', 'renderIn', 'parse', 'reconcile'],
100100
options: {hyperlinkMap: fakeHyperlinkMap, styles: fakeStyles},
101101
},
102+
{
103+
title: 'String with Invalid Number',
104+
create() {
105+
return new CellXform();
106+
},
107+
initialModel: {
108+
address: 'A1',
109+
type: Enums.ValueType.String,
110+
value: '6E1000',
111+
},
112+
preparedModel: {
113+
address: 'A1',
114+
type: Enums.ValueType.String,
115+
value: '6E1000',
116+
},
117+
xml: '<c r="A1" t="str"><v>6E1000</v></c>',
118+
parsedModel: {
119+
address: 'A1',
120+
type: Enums.ValueType.String,
121+
value: '6E1000',
122+
},
123+
reconciledModel: {
124+
address: 'A1',
125+
type: Enums.ValueType.String,
126+
value: '6E1000',
127+
},
128+
tests: ['prepare', 'render', 'renderIn', 'parse', 'reconcile'],
129+
options: {
130+
hyperlinkMap: fakeHyperlinkMap,
131+
styles: fakeStyles,
132+
},
133+
},
102134
{
103135
title: 'Inline String with plain text',
104136
create() {

0 commit comments

Comments
 (0)