mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-24 16:07:22 +02:00
Updated Style Guide (markdown)
parent
4a6a55f6f2
commit
054cd075f0
@ -10,26 +10,22 @@
|
|||||||
* constants - ALL_UPPER_CASE_WITH_UNDERSCORES
|
* constants - ALL_UPPER_CASE_WITH_UNDERSCORES
|
||||||
|
|
||||||
## Braces
|
## Braces
|
||||||
* No braces for single line control statements
|
* Always use braces and put them on same line even for single line control statements
|
||||||
|
|
||||||
```javascript
|
|
||||||
if (someVar)
|
|
||||||
return true;
|
|
||||||
```
|
|
||||||
* Opening brace on the same line
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
if (someVar) {
|
if (someVar) {
|
||||||
someVar += 2;
|
return true;
|
||||||
return someVar;
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
_Note: This wasn't always followed, but any new code should do this._
|
||||||
|
|
||||||
## White Space
|
## White Space
|
||||||
* Space after control statements (if, else, while, for, ...)
|
* Space after control statements (if, else, while, for, ...)
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
if (someVar)
|
if (someVar) {
|
||||||
```
|
```
|
||||||
|
|
||||||
## Classes
|
## Classes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user