mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +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)
|
Value StringPrototype::slice(Interpreter& interpreter)
|
||||||
{
|
{
|
||||||
auto* string_object = string_object_from(interpreter);
|
auto string = string_from(interpreter);
|
||||||
if (!string_object)
|
if (string.is_null())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto& string = string_object->primitive_string().string();
|
|
||||||
|
|
||||||
if (interpreter.argument_count() == 0)
|
if (interpreter.argument_count() == 0)
|
||||||
return js_string(interpreter, string);
|
return js_string(interpreter, string);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ try {
|
||||||
"concat",
|
"concat",
|
||||||
"substring",
|
"substring",
|
||||||
"includes",
|
"includes",
|
||||||
|
"slice",
|
||||||
];
|
];
|
||||||
|
|
||||||
genericStringPrototypeFunctions.forEach(name => {
|
genericStringPrototypeFunctions.forEach(name => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue