8000 Merge branch 'master' into fly-weight-es6 · wolfwithcode/design-patterns-JS@54f4492 · GitHub
[go: up one dir, main page]

Skip to content

Commit 54f4492

Browse files
committed
Merge branch 'master' into fly-weight-es6
# Conflicts: # docs.md
2 parents b0612d6 + d676dac commit 54f4492

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

docs.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ class PriceDiscount{
8585

8686
exec(products) {
8787
let result = 0;
88-
let total = products.reduce((a, b)=> {
89-
return a + b;
90-
});
88+
let total = products.reduce((a, b)=> a + b);
9189

9290
if (total >= 500)
9391
result = 0.1;
@@ -102,7 +100,7 @@ class NoneDiscount {
102100
};
103101
}
104102

105-
module.exports = [ShoppingCart, Discount];
103+
export { ShoppingCart , Discount };
106104

107105
```
108106
##### chain-of-resp.js

src/behavioral/chain-of-resp/chain-of-resp-es6.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class PriceDiscount{
4848

4949
exec(products) {
5050
let result = 0;
51-
let total = products.reduce((a, b)=> {
52-
return a + b;
53-
});
51+
let total = products.reduce((a, b)=> a + b);
5452

5553
if (total >= 500)
5654
result = 0.1;
@@ -65,4 +63,4 @@ class NoneDiscount {
6563
};
6664
}
6765

68-
module.exports = [ShoppingCart, Discount];
66+
export { ShoppingCart , Discount };

test/chain-of-resp-es6-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const expect = require('chai').expect;
22

3-
const [ShoppingCart, Discount] = require('../src/behavioral/chain-of-resp/chain-of-resp-es6');
3+
import {ShoppingCart, Discount} from '../src/behavioral/chain-of-resp/chain-of-resp-es6';
44

55
describe('chain of resp es6 tests', () => {
66

@@ -15,7 +15,7 @@ describe('chain of resp es6 tests', () => {
1515
expect(resp).to.equal(0.1);
1616
});
1717

18-
it('mote than 3 products', () => {
18+
it('more than 3 products', () => {
1919
const discount = new Discount();
2020

2121
const sc = new ShoppingCart();
@@ -29,7 +29,7 @@ describe('chain of resp es6 tests', () => {
2929
expect(resp).to.equal(0.05);
3030
});
3131

32-
it('mote than 3 products and > $ 500 ', () => {
32+
it('more than 3 products and > $ 500 ', () => {
3333
let discount = new Discount();
3434

3535
let sc = new ShoppingCart();

test/chain-of-resp-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('chain of resp tests', () => {
1515
expect(resp).to.equal(0.1);
1616
});
1717

18-
it('mote than 3 products', () => {
18+
it('more than 3 products', () => {
1919
var discount = new Discount();
2020

2121
var sc = new ShoppingCart();
@@ -29,7 +29,7 @@ describe('chain of resp tests', () => {
2929
expect(resp).to.equal(0.05);
3030
});
3131

32-
it('mote than 3 products and > $ 500 ', () => {
32+
it('more than 3 products and > $ 500 ', () => {
3333
var discount = new Discount();
3434

3535
var sc = new ShoppingCart();

0 commit comments

Comments
 (0)
0