Simplified String.prototype.repeat() to match the spec.
diff --git a/src/njs_string.c b/src/njs_string.c
index d865939..f5cf6b4 100644
--- a/src/njs_string.c
+++ b/src/njs_string.c
@@ -2924,7 +2924,6 @@
     njs_index_t unused)
 {
     u_char             *p;
-    double             count;
     int64_t            n, max;
     uint64_t           size, length;
     njs_int_t          ret;
@@ -2944,18 +2943,16 @@
         return ret;
     }
 
-    ret = njs_value_to_number(vm, njs_arg(args, nargs, 1), &count);
+    ret = njs_value_to_integer(vm, njs_arg(args, nargs, 1), &n);
     if (njs_slow_path(ret != NJS_OK)) {
         return ret;
     }
 
-    if (njs_slow_path(!isnan(count) && (count < 0 || isinf(count)))) {
+    if (njs_slow_path(n < 0 || n == INT64_MAX)) {
         njs_range_error(vm, NULL);
         return NJS_ERROR;
     }
 
-     n = njs_number_to_integer(count);
-
     (void) njs_string_prop(&string, this);
 
     if (njs_slow_path(n == 0 || string.size == 0)) {