Sha256: c113e77ff442fa2c10be200dd1aed3ebd72611b5456adf5a6dab13735e98cc1c
Contents?: true
Size: 503 Bytes
Versions: 69
Compression:
Stored size: 503 Bytes
Contents
define(['../lang/toString', '../number/toInt'], function(toString, toInt){ /** * Repeat string n times */ function repeat(str, n){ var result = ''; str = toString(str); n = toInt(n); if (n < 1) { return ''; } while (n > 0) { if (n % 2) { result += str; } n = Math.floor(n / 2); str += str; } return result; } return repeat; });
Version data entries
69 entries across 69 versions & 2 rubygems