Skip to content

Commit 3883687

Browse files
committed
Merge pull request johnpapa#32 from RichardLitt/patch-2
Applied IIFE and @namespace, @memberof
2 parents fde9161 + 7e96b1a commit 3883687

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,20 +2051,26 @@ Unit testing helps maintain clean code, as such I included some of my recommenda
20512051
20522052
## Comments
20532053
2054-
- **jsDoc**: If planning to produce documentation, use [`jsDoc`](http://usejsdoc.org/) syntax to document function names, description, params and returns
2054+
- **jsDoc**: If planning to produce documentation, use [`jsDoc`](http://usejsdoc.org/) syntax to document function names, description, params and returns. Use `@namespace` and `@memberOf` to match your app structure.
20552055
20562056
*Why?*: You can generate (and regenerate) documentation from your code, instead of writing it from scratch.
20572057
20582058
*Why?*: Provides consistency using a common industry tool.
20592059
20602060
```javascript
2061+
/**
2062+
* Logger Factory
2063+
* @namespace Factories
2064+
*/
2065+
(function() {
20612066
angular
20622067
.module('app')
20632068
.factory('logger', logger);
20642069

20652070
/**
2066-
* @name logger
2071+
* @namespace Logger
20672072
* @desc Application wide logger
2073+
* @memberOf Factories
20682074
*/
20692075
function logger($log) {
20702076
var service = {
@@ -2079,13 +2085,15 @@ Unit testing helps maintain clean code, as such I included some of my recommenda
20792085
* @desc Logs errors
20802086
* @param {String} msg Message to log
20812087
* @returns {String}
2088+
* @memberOf Factories.Logger
20822089
*/
20832090
function logError(msg) {
20842091
var loggedMsg = 'Error: ' + msg;
20852092
$log.error(loggedMsg);
20862093
return loggedMsg;
20872094
};
20882095
}
2096+
})();
20892097
```
20902098
20912099
**[Back to top](#table-of-contents)**

0 commit comments

Comments
 (0)