1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibJS: Make the StringIndexOf AO public

It will be used outside of String.prototype.
This commit is contained in:
Timothy Flynn 2024-01-03 13:20:35 -05:00 committed by Andreas Kling
parent 1b4a23095c
commit a984067567
Notes: sideshowbarker 2024-07-17 07:25:39 +09:00
2 changed files with 2 additions and 1 deletions

View file

@ -64,7 +64,7 @@ static Optional<size_t> split_match(Utf16View const& haystack, size_t start, Utf
}
// 6.1.4.1 StringIndexOf ( string, searchValue, fromIndex ), https://tc39.es/ecma262/#sec-stringindexof
static Optional<size_t> string_index_of(Utf16View const& string, Utf16View const& search_value, size_t from_index)
Optional<size_t> string_index_of(Utf16View const& string, Utf16View const& search_value, size_t from_index)
{
// 1. Let len be the length of string.
size_t string_length = string.length_in_code_units();

View file

@ -17,6 +17,7 @@ struct CodePoint {
size_t code_unit_count { 0 };
};
Optional<size_t> string_index_of(Utf16View const& string, Utf16View const& search_value, size_t from_index);
CodePoint code_point_at(Utf16View const& string, size_t position);
static constexpr Utf8View whitespace_characters = Utf8View("\x09\x0A\x0B\x0C\x0D\x20\xC2\xA0\xE1\x9A\x80\xE2\x80\x80\xE2\x80\x81\xE2\x80\x82\xE2\x80\x83\xE2\x80\x84\xE2\x80\x85\xE2\x80\x86\xE2\x80\x87\xE2\x80\x88\xE2\x80\x89\xE2\x80\x8A\xE2\x80\xAF\xE2\x81\x9F\xE3\x80\x80\xE2\x80\xA8\xE2\x80\xA9\xEF\xBB\xBF"sv);
ThrowCompletionOr<String> trim_string(VM&, Value string, TrimMode where);