From 7f0609248446a5af76062e2c1c8ba310e9149a93 Mon Sep 17 00:00:00 2001 From: brendandahl Date: Tue, 13 Mar 2012 10:54:28 -0700 Subject: [PATCH] Updated Style Guide (markdown) --- Style-Guide.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/Style-Guide.md b/Style-Guide.md index 4f6bb69..2055929 100644 --- a/Style-Guide.md +++ b/Style-Guide.md @@ -3,18 +3,43 @@ * Indentation - 2 spaces * Line Length - 80 characters +## Naming +* variables and functions - lowerCamelCase +* constructor like functions - UpperCamelCase +* constants - ALL_UPPER_CASE_WITH_UNDERSCORES + +## Braces +* No braces for single line control statements +``` +if (someVar) + return true; +``` +* Opening brace on the same line +``` +if (someVar) { + someVar += 2; + return someVar; +} +``` + +## White Space +* Space after control statements (if, else, while, for, ...) +``` +if (somevar) +``` + ## Classes The standard way of creating classes in pdf.js is the following. Please note that by class we mean an object that is class-like. -
+```
 var Name = (function NameClosure() {
   function Name(name) {
     this.name = name;
   }
 
   Name.prototype = {
+    ...
   };
-  ...
 
   return Name;
 })();
-
\ No newline at end of file +``` \ No newline at end of file