Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 1045652

Browse files
committed
Merge pull request #51 from mobify/pascal-modules
Also can use PascalCase for modules
2 parents 597e420 + 1cf6074 commit 1045652

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

javascript/README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,18 @@ var is_visible = true;
253253
var isVisible = true;
254254
````
255255

256-
##Use Pascal case for constructors
256+
##Use PascalCase only for constructors or modules
257+
258+
259+
### Constructors
260+
261+
````javascript
262+
// bad
263+
var Router = new Router();
264+
265+
// good
266+
var router = new Router();
267+
````
257268

258269
````javascript
259270
// bad
@@ -271,6 +282,23 @@ function AwesomeMovie(options) {
271282
var fiftyShades = new AwesomeMovie({ title: '50 Shades Of Grey' });
272283
````
273284

285+
### Modules
286+
287+
[What is a module pattern?](http://addyosmani.com/resources/essentialjsdesignpatterns/book/#modulepatternjavascript)
288+
289+
````javascript
290+
// bad
291+
var utils = {
292+
foo: function(){ return "bar" }
293+
};
294+
295+
// good
296+
var Utils = {
297+
foo: function(){ return "bar" }
298+
};
299+
300+
````
301+
274302
##Declare methods for objects on the prototype, not in the object constructor
275303

276304
````javascript

0 commit comments

Comments
 (0)