1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:17:45 +00:00

LibJS: Convert to_double() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-16 22:11:08 +03:00 committed by Linus Groh
parent 51c33b3b35
commit 1639ed7e0a
10 changed files with 23 additions and 40 deletions

View file

@ -41,7 +41,7 @@ String DateCell::display(Cell& cell, const CellTypeMetadata& metadata) const
JS::Value DateCell::js_value(Cell& cell, const CellTypeMetadata&) const
{
auto js_data = cell.js_data();
auto value = js_data.to_double(cell.sheet().global_object());
auto value = TRY_OR_DISCARD(js_data.to_double(cell.sheet().global_object()));
return JS::Value(value / 1000); // Turn it to seconds
}

View file

@ -34,7 +34,7 @@ String NumericCell::display(Cell& cell, const CellTypeMetadata& metadata) const
if (metadata.format.is_empty())
string = value.to_string_without_side_effects();
else
string = format_double(metadata.format.characters(), value.to_double(cell.sheet().global_object()));
string = format_double(metadata.format.characters(), TRY_OR_DISCARD(value.to_double(cell.sheet().global_object())));
if (metadata.length >= 0)
return string.substring(0, metadata.length);