Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit f1f947a

Browse files
committed
Added documentation.
1 parent a7625b7 commit f1f947a

File tree

6 files changed

+166
-0
lines changed

6 files changed

+166
-0
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"@neogeek/eslint-config-standards"
44
],
55
"rules": {
6+
"capitalized-comments": 0,
67
"no-shadow": 0,
78
"no-useless-escape": 0,
89
"sort-keys": 0

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ node_js:
66
- "7"
77
before_install:
88
- if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi
9+
- npm install doxdox -g
910
sudo: false

DOCUMENTATION.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# [doxdox-parser-dox](https://github.com/neogeek/doxdox-parser-dox) *1.0.5*
2+
3+
> Dox parser plugin for doxdox.
4+
5+
6+
### index.js
7+
8+
9+
#### formatStringForName(contents) *private method*
10+
11+
Format string as name.
12+
13+
14+
15+
16+
##### Parameters
17+
18+
- **contents** `String` String to format.
19+
20+
21+
22+
23+
##### Examples
24+
25+
```javascript
26+
formatStringForName('module.exports.parser');
27+
```
28+
29+
30+
##### Returns
31+
32+
33+
- `String` Formatted string.
34+
35+
36+
37+
#### formatStringForParam(contents) *private method*
38+
39+
Format string as param.
40+
41+
42+
43+
44+
##### Parameters
45+
46+
- **contents** `String` String to format.
47+
48+
49+
50+
51+
##### Examples
52+
53+
```javascript
54+
formatStringForParam('[optional param]');
55+
```
56+
57+
58+
##### Returns
59+
60+
61+
- `String` Formatted string.
62+
63+
64+
65+
#### formatStringForUID(contents) *private method*
66+
67+
Format string as UID.
68+
69+
70+
71+
72+
##### Parameters
73+
74+
- **contents** `String` String to format.
75+
76+
77+
78+
79+
##### Examples
80+
81+
```javascript
82+
formatStringForUID('example string');
83+
```
84+
85+
86+
##### Returns
87+
88+
89+
- `String` Formatted string.
90+
91+
92+
93+
#### parser(content, filename)
94+
95+
dox parser for doxdox.
96+
97+
98+
99+
100+
##### Parameters
101+
102+
- **content** `String` Contents of file.
103+
- **filename** `String` Name of file. Used to generate UIDs.
104+
105+
106+
107+
108+
##### Examples
109+
110+
```javascript
111+
parser(content, 'index.js').then(methods => console.log(methods));
112+
```
113+
114+
115+
##### Returns
116+
117+
118+
- `Promise` Promise with methods parsed from contents.
119+
120+
121+
122+
123+
*Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ lint:
88
$(BIN)/eslint index.js
99
$(BIN)/eslint 'test/specs/**/*.js'
1010

11+
docs:
12+
doxdox index.js --layout markdown --output DOCUMENTATION.md
13+
1114
.PHONY: test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
[![Build Status](https://travis-ci.org/neogeek/doxdox-parser-dox.svg?branch=master)](https://travis-ci.org/neogeek/doxdox-parser-dox)
66
[![NPM Version](http://img.shields.io/npm/v/doxdox-parser-dox.svg?style=flat)](https://www.npmjs.org/package/doxdox-parser-dox)
7+
[![Latest Documentation](https://doxdox.org/images/badge-flat.svg)](https://doxdox.org/)
78

89
## Install
910

index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,56 @@
11
const dox = require('dox');
22

3+
/**
4+
* Format string as name.
5+
*
6+
* @example formatStringForName('module.exports.parser');
7+
* @param {String} contents String to format.
8+
* @return {String} Formatted string.
9+
* @private
10+
*/
11+
312
const formatStringForName = content =>
413
content.toString()
514
.replace(/module\.exports\.|\.prototype|\(\)/g, '');
615

16+
/**
17+
* Format string as param.
18+
*
19+
* @example formatStringForParam('[optional param]');
20+
* @param {String} contents String to format.
21+
* @return {String} Formatted string.
22+
* @private
23+
*/
24+
725
const formatStringForParam = content =>
826
content.toString()
927
.replace(/\[|\]/g, '');
1028

29+
/**
30+
* Format string as UID.
31+
*
32+
* @example formatStringForUID('example string');
33+
* @param {String} contents String to format.
34+
* @return {String} Formatted string.
35+
* @private
36+
*/
37+
1138
const formatStringForUID = content =>
1239
content.toString()
1340
.toLowerCase()
1441
.replace(/[^\w\.]+/g, '-')
1542
.replace(/^-|-$/g, '');
1643

44+
/**
45+
* dox parser for doxdox.
46+
*
47+
* @example parser(content, 'index.js').then(methods => console.log(methods));
48+
* @param {String} content Contents of file.
49+
* @param {String} filename Name of file. Used to generate UIDs.
50+
* @return {Promise} Promise with methods parsed from contents.
51+
* @public
52+
*/
53+
1754
const parser = (content, filename) =>
1855
dox.parseComments(content, {'raw': true}).filter(method => !method.ignore && method.ctx)
1956
.map(method => ({

0 commit comments

Comments
 (0)