Skip to content

Commit bbaf9a2

Browse files
committed
fix(docs): accept return in addition to returns
documentation used @return but parser expected @returns, which made the generated documentation incomplete.
1 parent 7e70463 commit bbaf9a2

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

docs/src/ngdoc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ Doc.prototype = {
227227
'default':match[6]
228228
};
229229
self.param.push(param);
230-
} else if (atName == 'returns') {
230+
} else if (atName == 'returns' || atName == 'return') {
231231
match = text.match(/^\{([^}=]+)\}\s+(.*)/);
232232
if (!match) {
233-
throw new Error("Not a valid 'returns' format: " + text);
233+
throw new Error("Not a valid 'returns' format: " + text + ' in ' + self.file + ':' + self.line);
234234
}
235235
self.returns = {
236236
type: match[1],

src/auto/injector.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function inferInjectionArgs(fn) {
135135
* @param {Object=} self The `this` for the invoked method.
136136
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
137137
* the `$injector` is consulted.
138-
* @return the value returned by the invoked `fn` function.
138+
* @returns {*} the value returned by the invoked `fn` function.
139139
*/
140140

141141
/**
@@ -149,7 +149,7 @@ function inferInjectionArgs(fn) {
149149
* @param {function} Type Annotated constructor function.
150150
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
151151
* the `$injector` is consulted.
152-
* @return new instance of `Type`.
152+
* @returns {Object} new instance of `Type`.
153153
*/
154154

155155

src/ng/location.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ LocationUrl.prototype = {
214214
* Return full url representation with all segments encoded according to rules specified in
215215
* {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}.
216216
*
217-
* @return {string}
217+
* @return {string} full url
218218
*/
219219
absUrl: locationGetter('$$absUrl'),
220220

@@ -231,7 +231,7 @@ LocationUrl.prototype = {
231231
* Change path, search and hash, when called with parameter and return `$location`.
232232
*
233233
* @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
234-
* @return {string}
234+
* @return {string} url
235235
*/
236236
url: function(url, replace) {
237237
if (isUndefined(url))
@@ -255,7 +255,7 @@ LocationUrl.prototype = {
255255
*
256256
* Return protocol of current url.
257257
*
258-
* @return {string}
258+
* @return {string} protocol of current url
259259
*/
260260
protocol: locationGetter('$$protocol'),
261261

@@ -269,7 +269,7 @@ LocationUrl.prototype = {
269269
*
270270
* Return host of current url.
271271
*
272-
* @return {string}
272+
* @return {string} host of current url.
273273
*/
274274
host: locationGetter('$$host'),
275275

@@ -283,7 +283,7 @@ LocationUrl.prototype = {
283283
*
284284
* Return port of current url.
285285
*
286-
* @return {Number}
286+
* @return {Number} port
287287
*/
288288
port: locationGetter('$$port'),
289289

@@ -303,7 +303,7 @@ LocationUrl.prototype = {
303303
* if it is missing.
304304
*
305305
* @param {string=} path New path
306-
* @return {string}
306+
* @return {string} path
307307
*/
308308
path: locationGetterSetter('$$path', function(path) {
309309
return path.charAt(0) == '/' ? path : '/' + path;
@@ -325,7 +325,7 @@ LocationUrl.prototype = {
325325
* @param {string=} paramValue If `search` is a string, then `paramValue` will override only a
326326
* single search parameter. If the value is `null`, the parameter will be deleted.
327327
*
328-
* @return {string}
328+
* @return {string} search
329329
*/
330330
search: function(search, paramValue) {
331331
if (isUndefined(search))
@@ -358,7 +358,7 @@ LocationUrl.prototype = {
358358
* Change hash fragment when called with parameter and return `$location`.
359359
*
360360
* @param {string=} hash New hash fragment
361-
* @return {string}
361+
* @return {string} hash
362362
*/
363363
hash: locationGetterSetter('$$hash', identity),
364364

src/ngMock/angular-mocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ angular.mock.$LogProvider = function() {
578578
* This method is also available on window, where it can be used to display objects on debug console.
579579
*
580580
* @param {*} object - any object to turn into string.
581-
* @return a serialized string of the argument
581+
* @return {string} a serialized string of the argument
582582
*/
583583
angular.mock.dump = function(object) {
584584
return serialize(object);

0 commit comments

Comments
 (0)