source: node_modules/es-toolkit/dist/compat/string/repeat.js

Last change on this file 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
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const isIterateeCall = require('../_internal/isIterateeCall.js');
6const MAX_SAFE_INTEGER = require('../_internal/MAX_SAFE_INTEGER.js');
7const toInteger = require('../util/toInteger.js');
8const toString = require('../util/toString.js');
9
10function 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
23exports.repeat = repeat;
Note: See TracBrowser for help on using the repository browser.