diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-10-14 09:22:47 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-15 18:05:02 +0200 |
commit | e952dca02673422ed208ff2fef35536e82249137 (patch) | |
tree | ef334990ec337fd38553d026c34768eb9a66b90d | |
parent | a33cad119768f7af3a5a6d3785fdf2ff34d5d537 (diff) | |
download | serenity-e952dca02673422ed208ff2fef35536e82249137.zip |
LibJS: Expose the StringToNumber AO for public use
This will be needed outside of Value.cpp.
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Value.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Value.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 175bbde987..5ed60fefd9 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -524,7 +524,7 @@ static Optional<NumberParseResult> parse_number_text(StringView text) } // 7.1.4.1.1 StringToNumber ( str ), https://tc39.es/ecma262/#sec-stringtonumber -static Optional<Value> string_to_number(StringView string) +Optional<Value> string_to_number(StringView string) { // 1. Let text be StringToCodePoints(str). String text = Utf8View(string).trim(whitespace_characters, AK::TrimMode::Both).as_string(); diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index b02f05b8f3..ef65ca09cc 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -564,6 +564,8 @@ ThrowCompletionOr<TriState> is_less_than(VM&, Value lhs, Value rhs, bool left_fi double to_integer_or_infinity(double); +Optional<Value> string_to_number(StringView); + inline bool Value::operator==(Value const& value) const { return same_value(*this, value); } } |