Skip to content

Commit 76e28ee

Browse files
committed
Refactor single argument lambdas
1 parent f3a6bab commit 76e28ee

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

JavaScript/8-event.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
const adder = (initial) => {
3+
const adder = initial => {
44
let value = initial;
5-
const add = (delta) => {
5+
const add = delta => {
66
value += delta;
77
if (value >= add.maxValue) add.maxEvent(value);
88
return add;
@@ -17,7 +17,7 @@ const adder = (initial) => {
1717

1818
// Usage
1919

20-
const maxReached = (value) => {
20+
const maxReached = value => {
2121
console.log('max value reached, value: ' + value);
2222
};
2323

JavaScript/9-event-emitter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const events = require('events');
44

55
const emitter = new events.EventEmitter();
66

7-
emitter.on('new city', (city) => {
7+
emitter.on('new city', city => {
88
console.log('Emitted city: ' + city);
99
});
1010

11-
emitter.on('data', (array) => {
11+
emitter.on('data', array => {
1212
console.log(array.reduce((a, b) => a + b));
1313
});
1414

JavaScript/a-deferred.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const conferences = getConferences();
1717

1818
console.log(conferences);
1919

20-
conferences.data((list) => {
20+
conferences.data(list => {
2121
console.log(list);
2222
});
2323

JavaScript/b-errors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
// Implementation
44

5-
const adder = (value) => {
6-
const add = (a) => {
5+
const adder = value => {
6+
const add = a => {
77
value += a;
88
if (value >= add.maxValue) {
99
setImmediate(() => {

0 commit comments

Comments
 (0)