Skip to content

Commit 1d6fc28

Browse files
committedMay 26, 2017
update docs, run verb to generate readme
1 parent b8adc6e commit 1d6fc28

File tree

2 files changed

+71
-28
lines changed

2 files changed

+71
-28
lines changed
 

‎.verb.md

+30-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
1-
{{#block "logo"}}{{/block}}
21
## Usage
32

43
```js
5-
var centerAlign = require('{%= name %}');
4+
var center = require('{%= name %}');
5+
center(val, width);
66
```
77

8+
**Params**
9+
10+
- `val` **{String|Array}**: the string or array of strings to center align
11+
- `width` **{Number}** (optional): the total width of each line in the expected result, after it's centered.
12+
13+
## Examples
14+
15+
```js
16+
console.log(center('foo')); //=> 'foo' (does nothing)
17+
console.log(center('foo', 12)); //=> ' foo '
18+
console.log(center('foo', 10)); //=> ' foo '
19+
console.log(center('foo', 8)); //=> ' foo '
20+
```
21+
22+
### Multiple lines
23+
24+
If expected `width` is not provided, the _length of the longest line_ will be used.
25+
826
**Example**
927

1028
If used on the following:
1129

12-
```
13-
Lorem ipsum dolor sit amet,
14-
consectetur adipiscing
15-
elit, sed do eiusmod tempor incididunt
16-
ut labore et dolore
17-
magna aliqua. Ut enim ad minim
18-
veniam, quis
30+
```js
31+
// value can be a string, or an array of strings
32+
center([
33+
'Lorem ipsum dolor sit amet,',
34+
'consectetur adipiscing',
35+
'elit, sed do eiusmod tempor incididunt',
36+
'ut labore et dolore',
37+
'magna aliqua. Ut enim ad minim',
38+
'veniam, quis'
39+
]);
1940
```
2041

2142
The result would be:

‎README.md

+41-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# center-align [![NPM version](https://img.shields.io/npm/v/center-align.svg?style=flat)](https://www.npmjs.com/package/center-align) [![NPM downloads](https://img.shields.io/npm/dm/center-align.svg?style=flat)](https://npmjs.org/package/center-align) [![Build Status](https://img.shields.io/travis/jonschlinkert/center-align.svg?style=flat)](https://travis-ci.org/jonschlinkert/center-align)
1+
# center-align [![NPM version](https://img.shields.io/npm/v/center-align.svg?style=flat)](https://www.npmjs.com/package/center-align) [![NPM monthly downloads](https://img.shields.io/npm/dm/center-align.svg?style=flat)](https://npmjs.org/package/center-align) [![NPM total downloads](https://img.shields.io/npm/dt/center-align.svg?style=flat)](https://npmjs.org/package/center-align) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/center-align.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/center-align)
22

3-
Center-align the text in a string.
3+
> Center-align the text in a string.
44
55
## Install
66

@@ -13,20 +13,42 @@ $ npm install --save center-align
1313
## Usage
1414

1515
```js
16-
var centerAlign = require('center-align');
16+
var center = require('center-align');
17+
center(val, width);
1718
```
1819

20+
**Params**
21+
22+
* `val` **{String|Array}**: the string or array of strings to center align
23+
* `width` **{Number}** (optional): the total width of each line in the expected result, after it's centered.
24+
25+
## Examples
26+
27+
```js
28+
console.log(center('foo')); //=> 'foo' (does nothing)
29+
console.log(center('foo', 12)); //=> ' foo '
30+
console.log(center('foo', 10)); //=> ' foo '
31+
console.log(center('foo', 8)); //=> ' foo '
32+
```
33+
34+
### Multiple lines
35+
36+
If expected `width` is not provided, the _length of the longest line_ will be used.
37+
1938
**Example**
2039

2140
If used on the following:
2241

23-
```
24-
Lorem ipsum dolor sit amet,
25-
consectetur adipiscing
26-
elit, sed do eiusmod tempor incididunt
27-
ut labore et dolore
28-
magna aliqua. Ut enim ad minim
29-
veniam, quis
42+
```js
43+
// value can be a string, or an array of strings
44+
center([
45+
'Lorem ipsum dolor sit amet,',
46+
'consectetur adipiscing',
47+
'elit, sed do eiusmod tempor incididunt',
48+
'ut labore et dolore',
49+
'magna aliqua. Ut enim ad minim',
50+
'veniam, quis'
51+
]);
3052
```
3153

3254
The result would be:
@@ -55,34 +77,34 @@ Pull requests and stars are always welcome. For bugs and feature requests, [plea
5577

5678
### Building docs
5779

58-
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
80+
_(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.)_
5981

60-
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
82+
To generate the readme, run the following command:
6183

6284
```sh
63-
$ npm install -g verb verb-generate-readme && verb
85+
$ npm install -g verbose/verb#dev verb-generate-readme && verb
6486
```
6587

6688
### Running tests
6789

68-
Install dev dependencies:
90+
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:
6991

7092
```sh
71-
$ npm install -d && npm test
93+
$ npm install && npm test
7294
```
7395

7496
### Author
7597

7698
**Jon Schlinkert**
7799

78100
* [github/jonschlinkert](https://github.com/jonschlinkert)
79-
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
101+
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
80102

81103
### License
82104

83-
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
84-
Released under the [MIT license](https://github.com/jonschlinkert/center-align/blob/master/LICENSE).
105+
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
106+
Released under the [MIT License](LICENSE).
85107

86108
***
87109

88-
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on August 05, 2016._
110+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 26, 2017._

0 commit comments

Comments
 (0)
Please sign in to comment.