|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
671 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const isIterateeCall = require('../_internal/isIterateeCall.js');
|
|---|
| 6 | const MAX_SAFE_INTEGER = require('../_internal/MAX_SAFE_INTEGER.js');
|
|---|
| 7 | const toInteger = require('../util/toInteger.js');
|
|---|
| 8 | const toString = require('../util/toString.js');
|
|---|
| 9 |
|
|---|
| 10 | function repeat(str, n, guard) {
|
|---|
| 11 | if (guard ? isIterateeCall.isIterateeCall(str, n, guard) : n === undefined) {
|
|---|
| 12 | n = 1;
|
|---|
| 13 | }
|
|---|
| 14 | else {
|
|---|
| 15 | n = toInteger.toInteger(n);
|
|---|
| 16 | }
|
|---|
| 17 | if (n < 1 || n > MAX_SAFE_INTEGER.MAX_SAFE_INTEGER) {
|
|---|
| 18 | return '';
|
|---|
| 19 | }
|
|---|
| 20 | return toString.toString(str).repeat(n);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | exports.repeat = repeat;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.