Skip to content

Commit 58edee5

Browse files
committed
Enhance submission parsing to support exponential numeric values.
1 parent 45e4cce commit 58edee5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/parse-submission.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@ const numericFields = [
2525
for (const key of numericFields) {
2626
if (!(key in data)) continue;
2727

28-
const parsedNumber = Number(data[key]);
28+
const originalValue = data[key];
29+
const parsedNumber = Number(originalValue);
2930
if (isNaN(parsedNumber)) {
3031
delete data[key];
3132
} else {
32-
data[key] = parsedNumber;
33+
data[key] = originalValue.toLowerCase().includes('e')
34+
? 'EXPONENTIAL_MARKER_' + parsedNumber.toExponential()
35+
: parsedNumber;
3336
}
3437
}
3538

3639
const output = JSON.stringify({
3740
createdAt: process.env.ISSUE_CREATED_AT,
3841
url: process.env.ISSUE_URL,
3942
...data,
40-
});
43+
}).replace(/"EXPONENTIAL_MARKER_(.*?)"/g, '$1');
4144

4245
console.log(output);

0 commit comments

Comments
 (0)