Skip to content

Commit a3fe1d5

Browse files
Emmkuflash
authored andcommitted
Documentation improvements (#34)
* Improve grammar in documentation. * Fix example, the path is mandatory. * Demonstrate that applyParams handle arrays of values just fine. * Also improve example in class documentation.
1 parent 3cee288 commit a3fe1d5

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

api.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sitemap
22

3-
Generate sitemap by [React Router](https://www.npmjs.com/package/react-router) configuration.
3+
Generate a sitemap using the [React Router](https://www.npmjs.com/package/react-router) configuration.
44

55
**Examples**
66

@@ -10,13 +10,13 @@ import Sitemap from 'react-router-sitemap';
1010
const sitemap = (
1111
new Sitemap(<Route path='/home'>)
1212
.build('http://my-site.ru')
13-
.save();
13+
.save("./sitemap.xml");
1414
);
1515
```
1616

1717
## constructor
1818

19-
Convert React Router config to array of paths.
19+
Convert a React Router config to an array of paths.
2020

2121
**Parameters**
2222

@@ -32,7 +32,7 @@ const sitemap = new Sitemap(<Route path='/home'>);
3232

3333
## filterPaths
3434

35-
Filters path on the specified rules.
35+
Filter paths using the specified rules.
3636

3737
**Parameters**
3838

@@ -61,15 +61,15 @@ _Config for include `/auth` and `/thanks`_
6161

6262
## applyParams
6363

64-
Replaces the dynamic parameters in paths the passed value.
64+
Replace the dynamic parameters in paths using the given values.
6565

6666
**Parameters**
6767

68-
- `paramsConfig` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)&lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)>** Configuration for replace params.
68+
- `paramsConfig` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)&lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)>** Configuration for replacing params.
6969

7070
**Examples**
7171

72-
_Config for replace params `:param` in path `/path/:param`_
72+
_Config for replacing params `:param` in the path `/path/:param`_
7373

7474
```javascript
7575
{
@@ -79,13 +79,13 @@ _Config for replace params `:param` in path `/path/:param`_
7979
}
8080
```
8181

82-
_Config for replace params `:param` and `:subparam`
83-
in path `/path/:param/:subparam`_
82+
_Config for replacing params `:param` and `:subparam`
83+
in the path `/path/:param/:subparam`_
8484

8585
```javascript
8686
{
8787
'/path/:param/:subparam': [
88-
{ param: 'value', subparam: 'subvalue' }
88+
{ param: 'value', subparam: ['subvalue1', 'subvalue2'] }
8989
]
9090
}
9191
```
@@ -100,15 +100,15 @@ Convert array of paths to sitemap.
100100

101101
## save
102102

103-
Save sitemap in file.
103+
Save the sitemap to a file.
104104

105105
**Parameters**
106106

107107
- `dist` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The path and file name where the sitemap is saved.
108108

109109
# paramsApplier
110110

111-
Module for apply params in dynamic paths.
111+
Module for applying params in dynamic paths.
112112

113113
**Parameters**
114114

@@ -151,7 +151,7 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere
151151

152152
# pathsFilter
153153

154-
Module for filter array of paths.
154+
Module for filtering an array of paths.
155155

156156
**Parameters**
157157

@@ -189,7 +189,7 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere
189189

190190
# routesParser
191191

192-
Module for parsing result of execute function `createRoutes(<Route>)`
192+
Module for parsing the result of the `createRoutes(<Route>)` function.
193193
from [react-router](https://www.npmjs.com/package/react-router) package.
194194

195195
**Parameters**
@@ -221,7 +221,7 @@ Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere
221221

222222
# sitemapBuilder
223223

224-
Module for build sitemap by array of paths. Using [sitemap](https://www.npmjs.com/package/sitemap) package.
224+
Module for building a sitemap using an array of paths. Uses the [sitemap](https://www.npmjs.com/package/sitemap) package.
225225

226226
**Parameters**
227227

@@ -238,4 +238,4 @@ const hostname = 'http://may-site.ru';
238238
const sitemap = buildSitemap(hostname, paths);
239239
```
240240

241-
Returns **Sitemap** Instance of [Sitemap](https://www.npmjs.com/package/sitemap).
241+
Returns **Sitemap** instance of [Sitemap](https://www.npmjs.com/package/sitemap).

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import buildSitemap from './sitemap-builder';
1515
* const sitemap = (
1616
* new Sitemap(<Route path='/home'>)
1717
* .build('http://my-site.ru')
18-
* .save();
18+
* .save("./sitemap.xml");
1919
* );
2020
*/
2121
class Sitemap {
@@ -90,7 +90,7 @@ class Sitemap {
9090
* in path `/path/:param/:subparam`</caption>
9191
* {
9292
* '/path/:param/:subparam': [
93-
* { param: 'value', subparam: 'subvalue' }
93+
* { param: 'value', subparam: ['subvalue1', 'subvalue2'] }
9494
* ]
9595
* }
9696
*

readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
[![Build Status](https://travis-ci.org/kuflash/react-router-sitemap.svg?branch=master)](https://travis-ci.org/kuflash/react-router-sitemap) [![npm version](https://badge.fury.io/js/react-router-sitemap.svg)](https://badge.fury.io/js/react-router-sitemap)
44

5-
Module for generate sitemap by [React Router](https://www.npmjs.com/package/react-router) configuration. Also it can filter paths and replace params (like a `:paramName`) in dynamic paths.
5+
Module for generating sitemaps using [React Router](https://www.npmjs.com/package/react-router) configuration. Also it can filter paths and replace params (like a `:paramName`) in dynamic paths.
66

77
## Install
88

99
`npm i --save react-router-sitemap`
1010

1111
## Usage
1212

13-
You need have module with router configuration. For example:
13+
You need to have a module with the router configuration. For example:
1414

1515
`router.jsx`
1616
```js
@@ -27,7 +27,7 @@ export default (
2727
</Route>
2828
);
2929
```
30-
And need create script which will run from command line or on server.
30+
And you need to create a script which will run from the command line or on the server.
3131

3232
_Please note that in this case you need a module 'babel-register' to work with the ES2105 syntax and `.jsx` format._
3333

@@ -46,13 +46,13 @@ const Sitemap = require('../').default;
4646
);
4747
```
4848

49-
It's minimal example. After running the script next file will be created `sitemap.xml` which included all paths, described configuration `react-router`.
49+
It's a minimal example. After running the script, a `sitemap.xml` file will be created, which includes all paths, described in the configuration of `react-router`.
5050

51-
More detailed example you can see in the `example` directory. And explore detailed [API](api.md).
51+
A more detailed example can be found in the `example` directory. You can also explore the details of the [API](api.md).
5252

5353

5454
## [API](api.md)
55-
Explore public API for usage of module.
55+
Explore the public API for using the module.
5656

5757
## License
5858

0 commit comments

Comments
 (0)