1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

AK: Move trim_whitespace() into StringUtils and add it to StringView

No behaviour change; also patches use of `String::TrimMode` in LibJS.
This commit is contained in:
AnotherTest 2020-09-20 18:05:04 +04:30 committed by Andreas Kling
parent 50e9000b40
commit 5fbec2b003
6 changed files with 56 additions and 47 deletions

View file

@ -282,7 +282,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim)
auto string = ak_string_from(vm, global_object);
if (string.is_null())
return {};
return js_string(vm, string.trim_whitespace(String::TrimMode::Both));
return js_string(vm, string.trim_whitespace(TrimMode::Both));
}
JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim_start)
@ -290,7 +290,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim_start)
auto string = ak_string_from(vm, global_object);
if (string.is_null())
return {};
return js_string(vm, string.trim_whitespace(String::TrimMode::Left));
return js_string(vm, string.trim_whitespace(TrimMode::Left));
}
JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim_end)
@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::trim_end)
auto string = ak_string_from(vm, global_object);
if (string.is_null())
return {};
return js_string(vm, string.trim_whitespace(String::TrimMode::Right));
return js_string(vm, string.trim_whitespace(TrimMode::Right));
}
JS_DEFINE_NATIVE_FUNCTION(StringPrototype::concat)