Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
397 bytes
|
Line | |
---|
1 | /*!
|
---|
2 | * repeat-element <https://github.com/jonschlinkert/repeat-element>
|
---|
3 | *
|
---|
4 | * Copyright (c) 2015-present, Jon Schlinkert.
|
---|
5 | * Licensed under the MIT license.
|
---|
6 | */
|
---|
7 |
|
---|
8 | 'use strict';
|
---|
9 |
|
---|
10 | module.exports = function repeat(ele, num) {
|
---|
11 | if (Array.prototype.fill) {
|
---|
12 | return new Array(num).fill(ele);
|
---|
13 | }
|
---|
14 |
|
---|
15 | var arr = new Array(num);
|
---|
16 |
|
---|
17 | for (var i = 0; i < num; i++) {
|
---|
18 | arr[i] = ele;
|
---|
19 | }
|
---|
20 |
|
---|
21 | return arr;
|
---|
22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.