LibJS: Add JSON.stringify

This commit is contained in:
Matthew Olsson 2020-06-10 11:01:00 -07:00 committed by Andreas Kling
commit 39576b2238
Notes: sideshowbarker 2024-07-19 05:40:49 +09:00
19 changed files with 678 additions and 10 deletions

View file

@ -81,10 +81,7 @@ Value ArrayConstructor::construct(Interpreter& interpreter)
Value ArrayConstructor::is_array(Interpreter& interpreter)
{
auto value = interpreter.argument(0);
if (!value.is_array())
return Value(false);
// Exclude TypedArray and similar
return Value(StringView(value.as_object().class_name()) == "Array");
return Value(value.is_array());
}
Value ArrayConstructor::of(Interpreter& interpreter)