Skip to content

Commit 63454e3

Browse files
committed
Merge pull request #11 from raphaelpor/patch-4
Add some ES6 features
2 parents ae8a44f + 0998e61 commit 63454e3

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ The composition of two or more functions returns a new function.
161161
```javascript
162162
const compose = (f,g) => x => f(g(x));
163163

164-
const toUpperCase = function(x) { return x.toUpperCase(); };
165-
const exclaim = function(x) { return x + '!'; };
164+
const toUpperCase = x => x.toUpperCase();
165+
const exclaim = x => `${x}!`;
166166

167167
const angry = compose(exclaim, toUpperCase);
168168

@@ -175,9 +175,9 @@ angry("stop this");
175175
```javascript
176176
const compose = (f,g) => x => f(g(x));
177177

178-
const toUpperCase = function(x) { return x.toUpperCase(); };
179-
const exclaim = function(x) { return x + '!'; };
180-
const moreExclaim = function(x) { return x + '!!!!!'; };
178+
const toUpperCase = x => x.toUpperCase();
179+
const exclaim = x => `${x}!`;
180+
const moreExclaim = x => `${x}!!!!!`;
181181

182182
const reallyAngry = compose(exclaim, compose(toUpperCase, moreExclaim));
183183

@@ -209,9 +209,8 @@ console.log(a, b);
209209
3) Optional parameters
210210

211211
```javascript
212-
const ajax = function ({ url = "localhost", port: p = 80}, ...data) {
212+
const ajax = ({ url = "localhost", port: p = 80}, ...data) =>
213213
console.log("Url:", url, "Port:", p, "Rest:", data);
214-
};
215214

216215
ajax({ url: "someHost" }, "additional", "data", "hello");
217216
// Url: someHost Port: 80 Rest: [ 'additional', 'data', 'hello' ]

translations/pt-BR/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ A composição de duas ou mais funções retornando uma nova função.
157157
```javascript
158158
const compose = (f,g) => x => f(g(x));
159159

160-
const toUpperCase = function(x) { return x.toUpperCase(); };
161-
const exclaim = function(x) { return x + '!'; };
160+
const toUpperCase = x => x.toUpperCase();
161+
const exclaim = x => `${x}!`;
162162

163163
const angry = compose(exclaim, toUpperCase);
164164

@@ -171,9 +171,9 @@ angry("stop this");
171171
```javascript
172172
const compose = (f,g) => x => f(g(x));
173173

174-
const toUpperCase = function(x) { return x.toUpperCase(); };
175-
const exclaim = function(x) { return x + '!'; };
176-
const moreExclaim = function(x) { return x + '!!!!!'; };
174+
const toUpperCase = x => x.toUpperCase();
175+
const exclaim = x => `${x}!`;
176+
const moreExclaim = x => `${x}!!!!!`;
177177

178178
const reallyAngry = compose(exclaim, compose(toUpperCase, moreExclaim));
179179

@@ -205,9 +205,8 @@ console.log(a, b);
205205
3) Parâmetros opcionais
206206

207207
```javascript
208-
const ajax = function ({ url = "localhost", port: p = 80}, ...data) {
208+
const ajax = ({ url = "localhost", port: p = 80}, ...data) =>
209209
console.log("Url:", url, "Port:", p, "Rest:", data);
210-
};
211210

212211
ajax({ url: "someHost" }, "additional", "data", "hello");
213212
// Url: someHost Port: 80 Rest: [ 'additional', 'data', 'hello' ]

0 commit comments

Comments
 (0)