Projekt

Obecné

Profil

Stáhnout (2.84 KB) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
# repeat-element [![NPM version](https://img.shields.io/npm/v/repeat-element.svg?style=flat)](https://www.npmjs.com/package/repeat-element) [![NPM monthly downloads](https://img.shields.io/npm/dm/repeat-element.svg?style=flat)](https://npmjs.org/package/repeat-element) [![NPM total downloads](https://img.shields.io/npm/dt/repeat-element.svg?style=flat)](https://npmjs.org/package/repeat-element) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/repeat-element.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/repeat-element)
2
3
> Create an array by repeating the given value n times.
4
5
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
7
## Install
8
9
Install with [npm](https://www.npmjs.com/):
10
11
```sh
12
$ npm install --save repeat-element
13
```
14
15
## Usage
16
17
```js
18
const repeat = require('repeat-element');
19
20
repeat('a', 5);
21
//=> ['a', 'a', 'a', 'a', 'a']
22
23
repeat('a', 1);
24
//=> ['a']
25
26
repeat('a', 0);
27
//=> []
28
29
repeat(null, 5)
30
//» [ null, null, null, null, null ]
31
32
repeat({some: 'object'}, 5)
33
//» [ { some: 'object' },
34
//    { some: 'object' },
35
//    { some: 'object' },
36
//    { some: 'object' },
37
//    { some: 'object' } ]
38
39
repeat(5, 5)
40
//» [ 5, 5, 5, 5, 5 ]
41
```
42
43
## About
44
45
<details>
46
<summary><strong>Contributing</strong></summary>
47
48
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
49
50
</details>
51
52
<details>
53
<summary><strong>Running Tests</strong></summary>
54
55
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
56
57
```sh
58
$ npm install && npm test
59
```
60
61
</details>
62
63
<details>
64
<summary><strong>Building docs</strong></summary>
65
66
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
67
68
To generate the readme, run the following command:
69
70
```sh
71
$ npm install -g verbose/verb#dev verb-generate-readme && verb
72
```
73
74
</details>
75
76
### Contributors
77
78
| **Commits** | **Contributor** | 
79
| --- | --- |
80
| 17 | [jonschlinkert](https://github.com/jonschlinkert) |
81
| 3 | [LinusU](https://github.com/LinusU) |
82
| 1 | [architectcodes](https://github.com/architectcodes) |
83
84
### Author
85
86
**Jon Schlinkert**
87
88
* [GitHub Profile](https://github.com/jonschlinkert)
89
* [Twitter Profile](https://twitter.com/jonschlinkert)
90
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
91
92
### License
93
94
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
95
Released under the [MIT License](LICENSE).
96
97
***
98
99
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 19, 2018._