fix(docs): accept return in addition to returns

documentation used @return but parser expected
@returns, which made the generated documentation
incomplete.
This commit is contained in:
Misko Hevery 2012-05-16 22:20:35 -07:00
parent 7e70463da1
commit bbaf9a2870
4 changed files with 13 additions and 13 deletions

View file

@ -227,10 +227,10 @@ Doc.prototype = {
'default':match[6]
};
self.param.push(param);
} else if (atName == 'returns') {
} else if (atName == 'returns' || atName == 'return') {
match = text.match(/^\{([^}=]+)\}\s+(.*)/);
if (!match) {
throw new Error("Not a valid 'returns' format: " + text);
throw new Error("Not a valid 'returns' format: " + text + ' in ' + self.file + ':' + self.line);
}
self.returns = {
type: match[1],

View file

@ -135,7 +135,7 @@ function inferInjectionArgs(fn) {
* @param {Object=} self The `this` for the invoked method.
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
* the `$injector` is consulted.
* @return the value returned by the invoked `fn` function.
* @returns {*} the value returned by the invoked `fn` function.
*/
/**
@ -149,7 +149,7 @@ function inferInjectionArgs(fn) {
* @param {function} Type Annotated constructor function.
* @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before
* the `$injector` is consulted.
* @return new instance of `Type`.
* @returns {Object} new instance of `Type`.
*/

View file

@ -214,7 +214,7 @@ LocationUrl.prototype = {
* Return full url representation with all segments encoded according to rules specified in
* {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}.
*
* @return {string}
* @return {string} full url
*/
absUrl: locationGetter('$$absUrl'),
@ -231,7 +231,7 @@ LocationUrl.prototype = {
* Change path, search and hash, when called with parameter and return `$location`.
*
* @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
* @return {string}
* @return {string} url
*/
url: function(url, replace) {
if (isUndefined(url))
@ -255,7 +255,7 @@ LocationUrl.prototype = {
*
* Return protocol of current url.
*
* @return {string}
* @return {string} protocol of current url
*/
protocol: locationGetter('$$protocol'),
@ -269,7 +269,7 @@ LocationUrl.prototype = {
*
* Return host of current url.
*
* @return {string}
* @return {string} host of current url.
*/
host: locationGetter('$$host'),
@ -283,7 +283,7 @@ LocationUrl.prototype = {
*
* Return port of current url.
*
* @return {Number}
* @return {Number} port
*/
port: locationGetter('$$port'),
@ -303,7 +303,7 @@ LocationUrl.prototype = {
* if it is missing.
*
* @param {string=} path New path
* @return {string}
* @return {string} path
*/
path: locationGetterSetter('$$path', function(path) {
return path.charAt(0) == '/' ? path : '/' + path;
@ -325,7 +325,7 @@ LocationUrl.prototype = {
* @param {string=} paramValue If `search` is a string, then `paramValue` will override only a
* single search parameter. If the value is `null`, the parameter will be deleted.
*
* @return {string}
* @return {string} search
*/
search: function(search, paramValue) {
if (isUndefined(search))
@ -358,7 +358,7 @@ LocationUrl.prototype = {
* Change hash fragment when called with parameter and return `$location`.
*
* @param {string=} hash New hash fragment
* @return {string}
* @return {string} hash
*/
hash: locationGetterSetter('$$hash', identity),

View file

@ -578,7 +578,7 @@ angular.mock.$LogProvider = function() {
* This method is also available on window, where it can be used to display objects on debug console.
*
* @param {*} object - any object to turn into string.
* @return a serialized string of the argument
* @return {string} a serialized string of the argument
*/
angular.mock.dump = function(object) {
return serialize(object);