mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:38:13 +00:00
LibJS: Make String.prototype.slice() generic
This commit is contained in:
parent
cfdb7b8806
commit
8159f45f6e
2 changed files with 3 additions and 4 deletions
|
@ -388,12 +388,10 @@ Value StringPrototype::includes(Interpreter& interpreter)
|
|||
|
||||
Value StringPrototype::slice(Interpreter& interpreter)
|
||||
{
|
||||
auto* string_object = string_object_from(interpreter);
|
||||
if (!string_object)
|
||||
auto string = string_from(interpreter);
|
||||
if (string.is_null())
|
||||
return {};
|
||||
|
||||
auto& string = string_object->primitive_string().string();
|
||||
|
||||
if (interpreter.argument_count() == 0)
|
||||
return js_string(interpreter, string);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ try {
|
|||
"concat",
|
||||
"substring",
|
||||
"includes",
|
||||
"slice",
|
||||
];
|
||||
|
||||
genericStringPrototypeFunctions.forEach(name => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue