Skip to main content

repeat

Function repeat 

Source
pub fn repeat(s: &Str, count: f64, limits: &TenantLimits) -> Result<AdmittedStr>
Expand description

String.prototype.repeat. ToInteger(count) truncates toward zero, leaving three bands — and the guard order below encodes them, so NaN must fall through the negative check to the zero case:

  • count <= -1 → throws (negative repeat)
  • -1 < count < 1, or NaN → "" (zero repeats)
  • count >= 1 → repeat, capped so an overflowing or +Infinity count throws instead of allocating (see [MAX_RESULT_UNITS]).