mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibJS: Match spec behaviour in TypedArray.prototype.join
This corrects 2 TRYs to MUSTs and a replaces a call to is_nullish to is_undefined.
This commit is contained in:
parent
5341af6225
commit
db00097700
1 changed files with 3 additions and 3 deletions
|
@ -761,12 +761,12 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::join)
|
||||||
builder.append(separator);
|
builder.append(separator);
|
||||||
|
|
||||||
// b. Let element be ! Get(O, ! ToString(𝔽(k))).
|
// b. Let element be ! Get(O, ! ToString(𝔽(k))).
|
||||||
auto element = TRY(typed_array->get(i));
|
auto element = MUST(typed_array->get(i));
|
||||||
|
|
||||||
// c. If element is undefined, let next be the empty String; otherwise, let next be ! ToString(element).
|
// c. If element is undefined, let next be the empty String; otherwise, let next be ! ToString(element).
|
||||||
if (element.is_nullish())
|
if (element.is_undefined())
|
||||||
continue;
|
continue;
|
||||||
auto next = TRY(element.to_string(vm));
|
auto next = MUST(element.to_string(vm));
|
||||||
|
|
||||||
// d. Set R to the string-concatenation of R and next.
|
// d. Set R to the string-concatenation of R and next.
|
||||||
builder.append(next);
|
builder.append(next);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue