diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 756ff44b2d..148d1834fc 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -25,6 +25,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -59,16 +60,12 @@ static const double INVALID { 0 }; static const Crypto::SignedBigInteger BIGINT_ZERO { 0 }; -static bool is_valid_bigint_value(String string) +static bool is_valid_bigint_value(StringView string) { string = string.trim_whitespace(); if (string.length() > 1 && (string[0] == '-' || string[0] == '+')) string = string.substring_view(1, string.length() - 1); - for (auto& ch : string) { - if (!isdigit(ch)) - return false; - } - return true; + return all_of(string.begin(), string.end(), [](auto ch) { return isdigit(ch); }); } ALWAYS_INLINE bool both_number(const Value& lhs, const Value& rhs)