mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-12 17:03:09 +00:00
make @returns type non-optional
This commit is contained in:
parent
ff7c738c21
commit
4c69d694d7
4 changed files with 13 additions and 23 deletions
|
|
@ -208,12 +208,12 @@ function propertyTag(doc, name, value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function returnsTag(doc, name, value) {
|
function returnsTag(doc, name, value) {
|
||||||
var match = value.match(/^({(\S+)}\s*)?(.*)?/);
|
var match = value.match(/^{(\S+)}\s+(.*)?/);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
var tag = {
|
var tag = {
|
||||||
type: match[2],
|
type: match[1],
|
||||||
description: match[3] || false
|
description: match[2] || false
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw "[" + doc.raw.file + ":" + doc.raw.line +
|
throw "[" + doc.raw.file + ":" + doc.raw.line +
|
||||||
|
|
|
||||||
|
|
@ -161,24 +161,14 @@ describe('collect', function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('@returns', function() {
|
describe('@returns', function() {
|
||||||
it('should parse @returns', function() {
|
it('should not parse @returns without type', function() {
|
||||||
expect(function() {TAG.returns(doc, 'returns', '');})
|
expect(function() {TAG.returns(doc, 'returns', 'lala');})
|
||||||
.not.toThrow();
|
.toThrow();
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse @returns with type', function() {
|
|
||||||
TAG.returns(doc, 'returns', '{string}');
|
|
||||||
expect(doc.returns.type).toEqual('string');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse @returns with description', function() {
|
|
||||||
TAG.returns(doc, 'returns', 'descrip tion');
|
|
||||||
expect(doc.returns.description).toEqual('descrip tion');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse @returns with type and description', function() {
|
it('should parse @returns with type and description', function() {
|
||||||
TAG.returns(doc, 'returns', '{string} description');
|
TAG.returns(doc, 'returns', '{string} descrip tion');
|
||||||
expect(doc.returns).toEqual({type: 'string', description: 'description'});
|
expect(doc.returns).toEqual({type: 'string', description: 'descrip tion'});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ angularFormatter.json = formatter(toJson, fromJson);
|
||||||
* @description
|
* @description
|
||||||
* Use boolean formatter if you wish to store the data as boolean.
|
* Use boolean formatter if you wish to store the data as boolean.
|
||||||
*
|
*
|
||||||
* @returns Convert to `true` unless user enters (blank), `f`, `false`, `0`, `no`, `[]`.
|
* @returns {boolean} Converts to `true` unless user enters (blank), `f`, `false`, `0`, `no`, `[]`.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* Enter truthy text:
|
* Enter truthy text:
|
||||||
|
|
@ -62,7 +62,7 @@ angularFormatter['boolean'] = formatter(toString, toBoolean);
|
||||||
* @description
|
* @description
|
||||||
* Use number formatter if you wish to convert the user entered string to a number.
|
* Use number formatter if you wish to convert the user entered string to a number.
|
||||||
*
|
*
|
||||||
* @returns parse string to number.
|
* @returns {number} Number from the parsed string.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* Enter valid number:
|
* Enter valid number:
|
||||||
|
|
@ -89,9 +89,9 @@ angularFormatter.number = formatter(toString, function(obj){
|
||||||
* @name angular.formatter.list
|
* @name angular.formatter.list
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
* Use number formatter if you wish to convert the user entered string to a number.
|
* Use list formatter if you wish to convert the user entered string to an array.
|
||||||
*
|
*
|
||||||
* @returns parse string to number.
|
* @returns {Array} Array parsed from the entered string.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* Enter a list of items:
|
* Enter a list of items:
|
||||||
|
|
|
||||||
|
|
@ -994,7 +994,7 @@ angularServiceInject('$cookieStore', function($store) {
|
||||||
* Returns the value of given cookie key
|
* Returns the value of given cookie key
|
||||||
*
|
*
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @returns Cookie value
|
* @returns {Object} Deserialized cookie value
|
||||||
*/
|
*/
|
||||||
get: function(/**string*/key) {
|
get: function(/**string*/key) {
|
||||||
return fromJson($store[key]);
|
return fromJson($store[key]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue