cee7d174c96c2e71bc8d8bb4155f72f0671799b7
[platform/framework/web/crosswalk-tizen.git] /
1 # repeat-string [![NPM version](https://badge.fury.io/js/repeat-string.svg)](http://badge.fury.io/js/repeat-string)  [![Build Status](https://travis-ci.org/jonschlinkert/repeat-string.svg)](https://travis-ci.org/jonschlinkert/repeat-string) 
2
3 > Repeat the given string n times. Fastest implementation for repeating a string.
4
5 ## Install with [npm](npmjs.org)
6
7 ```bash
8 npm i repeat-string --save
9 ```
10 ## Install with [bower](https://github.com/bower/bower)
11
12 ```bash
13 bower install repeat-string --save
14 ```
15
16 ## Usage
17
18 ### [repeat](./index.js#L34)
19
20 Repeat the given `string` the specified `number` of times.
21
22 * `string` **{String}**: The string to repeat    
23 * `number` **{Number}**: The number of times to repeat the string    
24 * `returns` **{String}**: Repeated string  
25
26 **Example:**
27
28 ```js
29 var repeat = require('repeat-string');
30 repeat('A', 5);
31 //=> AAAAA
32 ```
33
34 ## Benchmarks
35
36 Repeat string is significantly faster than [repeating](https://github.com/sindresorhus/repeating).
37
38 ```bash
39 # 20,000x
40   repeat-string.js x 16,634,213 ops/sec ±0.92% (93 runs sampled)
41   repeating.js x 5,883,928 ops/sec ±0.95% (93 runs sampled)
42
43 # 2,000x
44   repeat-string.js x 17,438,654 ops/sec ±0.76% (97 runs sampled)
45   repeating.js x 6,639,978 ops/sec ±0.84% (97 runs sampled)
46
47 # 250x
48   repeat-string.js x 16,246,885 ops/sec ±0.81% (92 runs sampled)
49   repeating.js x 7,659,342 ops/sec ±0.67% (99 runs sampled)
50
51 # 50x
52   repeat-string.js x 15,803,340 ops/sec ±0.74% (92 runs sampled)
53   repeating.js x 9,668,300 ops/sec ±0.89% (98 runs sampled)
54
55 # 5x
56   repeat-string.js x 16,926,291 ops/sec ±0.78% (97 runs sampled)
57   repeating.js x 12,215,384 ops/sec ±1.01% (96 runs sampled)
58 ```
59
60 **Run the benchmarks**
61
62 Install dev dependencies:
63
64 ```bash
65 npm i -d && node benchmark
66 ```
67
68 ### Other javascript/node.js utils
69 [repeat-element](https://github.com/jonschlinkert/repeat-element): Create an array by repeating the given string n times.
70
71 ## Contributing
72 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/repeat-string/issues)
73
74 ## Running tests
75 Install dev dependencies:
76
77 ```bash
78 npm i -d && npm test
79 ```
80
81 ## Author
82
83 **Jon Schlinkert**
84
85 + [github/jonschlinkert](https://github.com/jonschlinkert)
86 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 
87
88 ## License
89 Copyright (c) 2015 Jon Schlinkert  
90 Released under the MIT license
91
92 ***
93
94 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 01, 2015._