Skip to content

Commit

Permalink
Merge pull request ryanmcdermott#96 from vsemozhetbyt/no-use-before-d…
Browse files Browse the repository at this point in the history
…efine

reorder class declarations
  • Loading branch information
ryanmcdermott authored Jan 10, 2017
2 parents 2d59de7 + b70664e commit 3f94eb2
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,16 @@ example below, the implicit contract is that any Request module for an
**Bad:**
```javascript
class InventoryRequester {
constructor() {
this.REQ_METHODS = ['HTTP'];
}

requestItem(item) {
// ...
}
}

class InventoryTracker {
constructor(items) {
this.items = items;
Expand All @@ -1344,16 +1354,6 @@ class InventoryTracker {
}
}

class InventoryRequester {
constructor() {
this.REQ_METHODS = ['HTTP'];
}

requestItem(item) {
// ...
}
}

const inventoryTracker = new InventoryTracker(['apples', 'bananas']);
inventoryTracker.requestItems();
```
Expand Down Expand Up @@ -1603,6 +1603,15 @@ class EmployeeTaxData extends Employee {
**Good**:
```javascript
class EmployeeTaxData {
constructor(ssn, salary) {
this.ssn = ssn;
this.salary = salary;
}

// ...
}

class Employee {
constructor(name, email) {
this.name = name;
Expand All @@ -1615,15 +1624,6 @@ class Employee {
}
// ...
}

class EmployeeTaxData {
constructor(ssn, salary) {
this.ssn = ssn;
this.salary = salary;
}

// ...
}
```
**[⬆ back to top](#table-of-contents)**
Expand Down

0 comments on commit 3f94eb2

Please sign in to comment.