Skip to content

Commit

Permalink
More symmetry with the styleguide of indent with 2 spaces in the STYL…
Browse files Browse the repository at this point in the history
…EGUIDE.md examples

* Applies to OpenUserJS#19 and pushed in OpenUserJS#245
  • Loading branch information
Martii committed Jul 8, 2014
1 parent 5e993ae commit 305fa0b
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ All functions should be declared, before they are used, after the variable decla

```javascript
function outer(c, d) {
var e = c * d;
var e = c * d;

function inner(a, b) {
return (e * a) + b;
}
function inner(a, b) {
return (e * a) + b;
}

return inner(0, 1);
return inner(0, 1);
}
```

When a function is to be invoked immediately, the entire invocation expression should be wrapped in parenthesis so that it's clear that the value being produced is the result of the function being invoked and not the function itself.

```javascript
var collection = (function () {
// code here
/* code here */
}());
```

Expand All @@ -76,14 +76,14 @@ If the space is omitted, then it can appear that the function's name is `functio

```javascript
div.onclick = function (e) {
return false;
return false;
};

that = {
method: function () {
return this.datum;
},
datum: 0
method: function () {
return this.datum;
},
datum: 0
};
```

Expand Down Expand Up @@ -201,21 +201,21 @@ The `if` class of statements should have the following form:

```javascript
if (condition) {
/* statements */
/* statements */
}

if (condition) {
/* statements */
/* statements */
} else {
/* statements */
/* statements */
}

if (condition) {
/* statements */
/* statements */
} else if (condition) {
/* statements */
/* statements */
} else {
/* statements */
/* statements */
}
```

Expand All @@ -225,13 +225,13 @@ A for class of statements should have the following form:

```javascript
for (initialization; condition; update) {
/* statements */
/* statements */
}

for (variable in object) {
if (filter) {
/* statements */
}
if (filter) {
/* statements */
}
}
```

Expand All @@ -246,7 +246,7 @@ A `while` statement should have the following form:

```javascript
while (condition) {
/* statements */
/* statements */
}
```

Expand All @@ -256,7 +256,7 @@ A `do` statement should have the following form:

```javascript
do {
/* statements */
/* statements */
} while (condition);
```

Expand Down Expand Up @@ -292,17 +292,17 @@ The `try` class of statements should have the following form:

```javascript
try {
/* statements */
/* statements */
} catch (variable) {
/* statements */
/* statements */
}

try {
/* statements */
/* statements */
} catch (variable) {
/* statements */
/* statements */
} finally {
/* statements */
/* statements */
}
```

Expand Down

0 comments on commit 305fa0b

Please sign in to comment.