8000 documentation update · wolfwithcode/design-patterns-JS@093d50f · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 093d50f

Browse files
committed
documentation update
1 parent 3724c6a commit 093d50f

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Design Patterns JS [![Coverage Status](https://coveralls.io/repos/github/FelipeBB/GoF-JS/badge.svg?branch=master)](https://coveralls.io/github/FelipeBB/GoF-JS?branch=master)
1+
## Design Patterns JS [![Coverage Status](https://coveralls.io/repos/github/FelipeBB/Design-Patterns-JS/badge.svg?branch=master)](https://coveralls.io/github/FelipeBB/Design-Patterns-JS?branch=master)
22

33
Here you will find the 23 (GoF) design patterns implemented in JavaScript using both prototype and ES6 classes. You can use the [**docs.md**](docs.md) to quicky overview the examples.
44

docs.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ module.exports = [Cockpit, Turbine, OnCommand, OffCommand, SpeedUpCommand, Speed
171171
```
172172
##### command_es6.js
173173
```Javascript
174-
class Cockipt {
174+
class Cockpit {
175175
constructor(command) {
176176
this.command = command;
177177
}
@@ -210,7 +210,8 @@ class OffCommand {
210210
}
211211
}
212212

213-
module.exports = [Cockipt, Turbine, OnCommand, OffCommand];
213+
export { Cockpit, Turbine, OnCommand, OffCommand };
214+
214215

215216
```
216217

@@ -282,7 +283,7 @@ class Num {
282283
}
283284

284285

285-
module.exports = [Num, Min, Sum];
286+
export { Num, Min, Sum };
286287

287288
```
288289

@@ -323,7 +324,7 @@ class Iterator {
323324
}
324325
}
325326

326-
module.exports = Iterator;
327+
export default Iterator;
327328

328329
```
329330

@@ -380,7 +381,7 @@ class Airplane{
380381
}
381382

382383

383-
module.exports = [TrafficTower, Airplane];
384+
export { TrafficTower, Airplane };
384385

385386
```
386387

@@ -423,7 +424,7 @@ class Memento {
423424
}
424425
}
425426

426-
var originator = {
427+
const originator = {
427428
store: function(val) {
428429
return new Memento(val);
429430
},
@@ -448,7 +449,7 @@ class Caretaker {
448449

449450

450451

451-
module.exports = [originator, Caretaker];
452+
export { originator, Caretaker };
452453

453454
```
454455

@@ -538,7 +539,7 @@ class proft {
538539
}
539540
}
540541

541-
module.exports = [Product, fees, proft];
542+
export { Product, fees, proft };
542543

543544
```
544545

@@ -620,7 +621,7 @@ class Order {
620621
};
621622
}
622623

623-
module.exports = Order;
624+
export default Order;
624625

625626
```
626627

@@ -685,7 +686,7 @@ function premiumStrategy(amount) {
685686
return amount * 0.8;
686687
}
687688

688-
module.exports = [ShoppingCart, guestStrategy, regularStrategy, premiumStrategy];
689+
export { ShoppingCart, guestStrategy, regularStrategy, premiumStrategy };
689690

690691
```
691692

@@ -758,7 +759,7 @@ class Tax2 extends Tax {
758759
}
759760
}
760761

761-
module.exports = [Tax1, Tax2];
762+
export { Tax1, Tax2 };
762763

763764
```
764765

@@ -828,7 +829,7 @@ class Developer extends Employee {
828829
}
829830
}
830831

831-
module.exports = [Developer, Manager, bonusVisitor];
832+
export { Developer, Manager, bonusVisitor };
832833

833834
```
834835

@@ -892,7 +893,7 @@ class Rx24 {
892893
}
893894

894895

895-
module.exports = droidProducer;
896+
export default droidProducer;
896897

897898
```
898899

@@ -969,7 +970,7 @@ class RequestBuilder {
969970

970971
}
971972

972-
module.exports = RequestBuilder;
973+
export default RequestBuilder;
973974

974975
```
975976

@@ -1012,7 +1013,7 @@ class Bmw {
10121013
}
10131014
}
10141015

1015-
module.exports = BmwFactory;
1016+
export default BmwFactory;
10161017

10171018
```
10181019

@@ -1045,7 +1046,7 @@ class Sheep {
10451046
}
10461047
}
10471048

1048-
module.exports = Sheep;
1049+
export default Sheep;
10491050

10501051
```
10511052

@@ -1077,7 +1078,7 @@ class Person {
10771078
}
10781079
}
10791080

1080-
module.exports = Person;
1081+
export default Person;
10811082

10821083
```
10831084

@@ -1145,7 +1146,7 @@ class JediAdapter {
11451146
}
11461147
}
11471148

1148-
module.exports = [Soldier, Jedi, JediAdapter];
1149+
export { Soldier, Jedi, JediAdapter };
11491150

11501151
```
11511152

@@ -1226,7 +1227,7 @@ class AlcoholInk extends Ink {
12261227
}
12271228
}
12281229

1229-
module.exports = [EpsonPrinter, HPprinter, AcrylicInk, AlcoholInk];
1230+
export { EpsonPrinter, HPprinter, AcrylicInk, AlcoholInk };
12301231

12311232
```
12321233

@@ -1350,7 +1351,7 @@ class Memory extends Equipment {
13501351
}
13511352
}
13521353

1353-
module.exports = [Cabbinet, FloppyDisk, HardDrive, Memory];
1354+
export { Cabbinet, FloppyDisk, HardDrive, Memory };
13541355

13551356
```
13561357

@@ -1440,7 +1441,7 @@ class CheeseDecorator extends PastaDecorator {
14401441
}
14411442
}
14421443

1443-
module.exports = [Penne, SauceDecorator, CheeseDecorator];
1444+
export { Penne, SauceDecorator, CheeseDecorator };
14441445

14451446
```
14461447

@@ -1508,7 +1509,7 @@ class Fees {
15081509
}
15091510
}
15101511

1511-
module.exports = ShopFacade;
1512+
export default ShopFacade;
15121513

15131514
```
15141515

0 commit comments

Comments
 (0)
0