mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibJS: Convert to_u8_clamp() to ThrowCompletionOr
This commit is contained in:
parent
99287afc99
commit
750da61c0f
3 changed files with 4 additions and 4 deletions
|
@ -671,9 +671,9 @@ ThrowCompletionOr<u8> Value::to_u8(GlobalObject& global_object) const
|
|||
}
|
||||
|
||||
// 7.1.12 ToUint8Clamp ( argument ), https://tc39.es/ecma262/#sec-touint8clamp
|
||||
u8 Value::to_u8_clamp(GlobalObject& global_object) const
|
||||
ThrowCompletionOr<u8> Value::to_u8_clamp(GlobalObject& global_object) const
|
||||
{
|
||||
auto number = TRY_OR_DISCARD(to_number(global_object));
|
||||
auto number = TRY(to_number(global_object));
|
||||
if (number.is_nan())
|
||||
return 0;
|
||||
double value = number.as_double();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue