@@ -45,8 +45,7 @@ <h2 id="synonyms">Synonyms</h2>
45
45
< code > @return</ code >
46
46
</ p >
47
47
< h2 id ="syntax "> Syntax</ h2 >
48
- < p > < code > @returns [{type}] [description]</ code >
49
- </ p >
48
+ < p > < code > @returns [{type}] [description]</ code > </ p >
50
49
< h2 id ="overview "> Overview</ h2 >
51
50
< p > The < code > @returns</ code > tag documents the value that a function returns.</ p >
52
51
< p > If you are documenting a generator function, use the < a href ="tags-yields.html "> < code > @yields</ code > tag</ a > instead of this tag.
@@ -55,43 +54,53 @@ <h2 id="examples">Examples</h2>
55
54
< figure >
56
55
< figcaption > Return value with a type</ figcaption > < pre class ="prettyprint lang-js "> < code > /**
57
56
* Returns the sum of a and b
58
- * @param {Number } a
59
- * @param {Number } b
60
- * @returns {Number }
57
+ * @param {number } a
58
+ * @param {number } b
59
+ * @returns {number }
61
60
*/
62
61
function sum(a, b) {
63
62
return a + b;
64
63
}
65
- </ code > </ pre >
66
- </ figure >
64
+ </ code > </ pre > </ figure >
67
65
< figure >
68
66
< figcaption > Return value with a type and description</ figcaption > < pre class ="prettyprint lang-js "> < code > /**
69
67
* Returns the sum of a and b
70
- * @param {Number } a
71
- * @param {Number } b
72
- * @returns {Number } Sum of a and b
68
+ * @param {number } a
69
+ * @param {number } b
70
+ * @returns {number } Sum of a and b
73
71
*/
74
72
function sum(a, b) {
75
73
return a + b;
76
74
}
77
- </ code > </ pre >
78
- </ figure >
75
+ </ code > </ pre > </ figure >
79
76
< figure >
80
77
< figcaption > Return value with multiple types</ figcaption > < pre class ="prettyprint lang-js "> < code > /**
81
78
* Returns the sum of a and b
82
- * @param {Number } a
83
- * @param {Number } b
84
- * @param {Boolean } retArr If set to true, the function will return an array
85
- * @returns {(Number |Array)} Sum of a and b or an array that contains a, b and the sum of a and b.
79
+ * @param {number } a
80
+ * @param {number } b
81
+ * @param {boolean } retArr If set to true, the function will return an array
82
+ * @returns {(number |Array)} Sum of a and b or an array that contains a, b and the sum of a and b.
86
83
*/
87
84
function sum(a, b, retArr) {
88
85
if (retArr) {
89
86
return [a, b, a + b];
90
87
}
91
88
return a + b;
92
89
}
93
- </ code > </ pre >
94
- </ figure >
90
+ </ code > </ pre > </ figure >
91
+ < figure >
92
+ < figcaption > Returns a promise</ figcaption > < pre class ="prettyprint lang-js "> < code > /**
93
+ * Returns the sum of a and b
94
+ * @param {number} a
95
+ * @param {number} b
96
+ * @returns {Promise< number > } Promise object represents the sum of a and b
97
+ */
98
+ function sumAsync(a, b) {
99
+ return new Promise(function(resolve, reject) {
100
+ resolve(a + b);
101
+ });
102
+ }
103
+ </ code > </ pre > </ figure >
95
104
< h2 id ="related-links "> Related Links</ h2 >
96
105
< ul >
97
106
< li >
@@ -104,8 +113,7 @@ <h2 id="related-links">Related Links</h2>
104
113
</ article >
105
114
< footer >
106
115
< a class ="license-badge " href ="http://creativecommons.org/licenses/by-sa/3.0/ ">
107
- < img alt ="Creative Commons License " class ="license-badge " src ="images/cc-by-sa.svg " width ="80 " height ="15 " />
108
- </ a >
116
+ < img alt ="Creative Commons License " class ="license-badge " src ="images/cc-by-sa.svg " width ="80 " height ="15 " /> </ a >
109
117
< br > Copyright © 2011-2017 the
110
118
< a href ="https://github.com/jsdoc3/jsdoc3.github.com/contributors "> contributors</ a > to the JSDoc 3 documentation project.
111
119
< br > This website is < a href ="https://github.com/jsdoc3/jsdoc3.github.com "> open source</ a > and is licensed under the < a rel ="license " href ="http://creativecommons.org/licenses/by-sa/3.0/ ">
0 commit comments