@@ -61,18 +61,25 @@ var setOptionData = function (option, data) {
61
61
*
62
62
* @signature `@option {TYPE} NAME [DESCRIPTION]`
63
63
*
64
+ * Here's an example of some ways you can use the `@option` tag:
65
+ *
64
66
* @codestart javascript
65
67
* /**
66
- * * Retrieves a list of orders.
67
- * *
68
- * * @param {{} } params A parameter object with the following options:
69
- * * @option {String} type Specifies the type of order.
70
- * * @option {Number} [createdAt] Retrieves orders after this timestamp.
71
- * *
72
- * * @param {function(Orders.List) } [success(orders)] Callback function.
73
- * * @option orders A list of [Orders] that match `params`.
68
+ * * @module {{}} ledger Ledger
74
69
* *|
75
- * find: function( params, success ) { ... }
70
+ * module.exports = {
71
+ * /**
72
+ * * Retrieves a list of orders.
73
+ * *
74
+ * * @param {{} } params A parameter object with the following options:
75
+ * * @option {String} type Specifies the type of order.
76
+ * * @option {Number} [createdAt] Retrieves orders after this timestamp.
77
+ * *
78
+ * * @param {function(Orders.List) } [success(orders)] Callback function.
79
+ * * @option orders A list of [Orders] that match `params`.
80
+ * *|
81
+ * find: function(params, success) { /*...*| }
82
+ * };
76
83
* @codeend
77
84
*
78
85
* @param {bit-docs/typeExpression } [TYPE] A [bit-docs/typeExpression type expression]. Examples:
@@ -88,18 +95,107 @@ var setOptionData = function (option, data) {
88
95
* @codestart
89
96
* /**
90
97
* * @param {{type: String} } params An object with the following options:
91
- * * @option type Specifies the type of order.
92
- * * @option label Retrieves only orders with this label.
98
+ * * @option type Specifies the type of order.
99
+ * * @option label Retrieves only orders with this label.
93
100
* *|
94
101
* @codeend
95
102
*
103
+ * However, omitting TYPE might confuse your team members, so we recommend
104
+ * being explicit and always specifying TYPE for `@option`.
105
+ *
96
106
* @param {bit-docs/nameExpression } NAME A [bit-docs/nameExpression name expression]. Examples:
97
107
*
98
108
* `age` - age is item.
99
109
* `[age]` - age is item, age is optional.
100
110
* `[age=0]` - age defaults to 0.
101
111
*
102
112
* @param {Markdown } [DESCRIPTION] Markdown content that continues for multiple lines.
113
+ *
114
+ * @body
115
+ *
116
+ * ### Usage Examples
117
+ *
118
+ * @codestart javascript
119
+ * /**
120
+ * * @module {{}} foo Foo
121
+ * *|
122
+ * module.exports = {
123
+ * /**
124
+ * * A function named bar.
125
+ * *
126
+ * * @param {{} } params A parameter object with options:
127
+ * * @option {String} aString An arbitrary string.
128
+ * * @option {Number} [oNumber] An optional number.
129
+ * *|
130
+ * bar: function(params) { /*...*| }
131
+ * };
132
+ * @codeend
133
+ *
134
+ * Resulting [bit-docs/types/docObject]:
135
+ *
136
+ * @codestart javascript
137
+ * {
138
+ * "type": "function",
139
+ * "name": "foo.bar",
140
+ * "params": [
141
+ * {
142
+ * "types": [
143
+ * {
144
+ * "type": "Object",
145
+ * "options": [
146
+ * {
147
+ * "name": "aString",
148
+ * "description": "An arbitrary string.",
149
+ * "types": [
150
+ * {
151
+ * "type": "String"
152
+ * }
153
+ * ]
154
+ * },
155
+ * {
156
+ * "name": "oNumber",
157
+ * "description": "An optional number.\n",
158
+ * "types": [
159
+ * {
160
+ * "type": "Number"
161
+ * }
162
+ * ],
163
+ * "optional": true
164
+ * }
165
+ * ]
166
+ * }
167
+ * ],
168
+ * "name": "params",
169
+ * "description": "A parameter object with options:"
170
+ * }
171
+ * ],
172
+ * "parent": "foo",
173
+ * "description": "A function named bar.\n"
174
+ * }
175
+ * @codeend
176
+ *
177
+ * That [bit-docs/types/docObject] an be used in a template like this:
178
+ *
179
+ * @codestart html
180
+ * {{#if params}}
181
+ * {{#params}}
182
+ * {{#types}}
183
+ * {{#if options.length}}
184
+ * {{#options}}
185
+ * <p>
186
+ * Option Name: {{name}}
187
+ * <br/>
188
+ * Option Description: {{description}}
189
+ * </p>
190
+ * {{/options}}
191
+ * {{/if}}
192
+ * {{/types}}
193
+ * {{/params}}
194
+ * {{/if}}
195
+ * @codeend
196
+ *
197
+ * See [signature.mustache] for a more complex template that uses the
198
+ * [bit-docs/types/docObject] resulting from `@option`.
103
199
*/
104
200
module . exports = {
105
201
addMore : function ( line , last ) {
0 commit comments