Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 1x | import {toStr} from "../helpers/string/to_string"
import {clip} from "../helpers/number/clip"
import {toInt} from "../helpers/number/to_integer"
import { MAX_SAFE_INTEGER } from "../helpers/number/const"
export const repeat = (s, times = 0) => {
let _s = toStr(s)
let _times = !times ? _s.length : clip(toInt(times), 0, MAX_SAFE_INTEGER)
const _origin = _s
if (times === 0) {
return "";
}
for(let i = 0; i < _times - 1; i++) {
_s += _origin
}
return _s
} |