Skip to content

Commit 5d3daf1

Browse files
committed
Fix eslint rule: arrow-parens
1 parent 9eb0c3d commit 5d3daf1

12 files changed

Lines changed: 35 additions & 35 deletions

File tree

Exercises/1-pipe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
22

3-
const pipe = (...fns) => x => null;
3+
const pipe = (...fns) => (x) => null;
44

55
module.exports = { pipe };

Exercises/2-compose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
22

3-
const compose = (...fns) => x => null;
3+
const compose = (...fns) => (x) => null;
44

55
module.exports = { compose };

JavaScript/1-superposition.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { log: ln } = Math;
44
const pow = Math.pow;
55
const sqrt = Math.sqrt;
6-
const inc = x => ++x;
6+
const inc = (x) => ++x;
77
const add = (a, b) => a + b;
88
const mul = (a, b) => a * b;
99
const div = (a, b) => a / b;
@@ -28,4 +28,4 @@ console.log('Loop from 5 to 10');
2828
loop(5, 10, console.log);
2929

3030
console.log('Loop from 5 to 10, write < 8');
31-
loop(5, 10, x => iff(x < 8, console.log, () => {})(x));
31+
loop(5, 10, (x) => iff(x < 8, console.log, () => {})(x));

JavaScript/2-composition.js

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

3-
const compose = (f, g) => x => f(g(x));
3+
const compose = (f, g) => (x) => f(g(x));
44

55
// Usage
66

7-
const upperFirst = word => word.charAt(0).toUpperCase() + word.slice(1);
8-
const upperCapital = s => s.split(' ').map(upperFirst).join(' ');
9-
const lower = s => s.toLowerCase();
7+
const upperFirst = (word) => word.charAt(0).toUpperCase() + word.slice(1);
8+
const upperCapital = (s) => s.split(' ').map(upperFirst).join(' ');
9+
const lower = (s) => s.toLowerCase();
1010

1111
const capitalize = compose(upperCapital, lower);
1212

JavaScript/3-arguments.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ const pipe = (f, g) => (...args) => g(f(...args));
55

66
// Usage
77

8-
const upperFirst = word => word.charAt(0).toUpperCase() + word.slice(1);
9-
const upperCapital = s => s.split(' ').map(upperFirst).join(' ');
10-
const lower = s => s.toLowerCase();
8+
const upperFirst = (word) => word.charAt(0).toUpperCase() + word.slice(1);
9+
const upperCapital = (s) => s.split(' ').map(upperFirst).join(' ');
10+
const lower = (s) => s.toLowerCase();
1111

1212
const s = 'MARCUS AURELIUS';
1313
console.log(s);

JavaScript/4-multiple.js

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

3-
const compose = (...fns) => x => fns.reduceRight((v, f) => f(v), x);
4-
const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x);
3+
const compose = (...fns) => (x) => fns.reduceRight((v, f) => f(v), x);
4+
const pipe = (...fns) => (x) => fns.reduce((v, f) => f(v), x);
55

66
// Usage
77

8-
const upperFirst = word => word.charAt(0).toUpperCase() + word.slice(1);
9-
const upperCapital = s => s.split(' ').map(upperFirst).join(' ');
10-
const lower = s => s.toLowerCase();
11-
const trim = s => s.trim();
8+
const upperFirst = (word) => word.charAt(0).toUpperCase() + word.slice(1);
9+
const upperCapital = (s) => s.split(' ').map(upperFirst).join(' ');
10+
const lower = (s) => s.toLowerCase();
11+
const trim = (s) => s.trim();
1212

1313
const s = ' MARCUS AURELIUS ';
1414
console.log(s);

JavaScript/5-loop.js

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

3-
const compose = (...fns) => x => {
3+
const compose = (...fns) => (x) => {
44
const last = fns.length - 1;
55
let res = x;
66
for (let i = last; i >= 0; i--) {
@@ -9,7 +9,7 @@ const compose = (...fns) => x => {
99
return res;
1010
};
1111

12-
const pipe = (...fns) => x => {
12+
const pipe = (...fns) => (x) => {
1313
let res = x;
1414
for (let i = 0; i < fns.length; i++) {
1515
res = fns[i](res);
@@ -19,10 +19,10 @@ const pipe = (...fns) => x => {
1919

2020
// Usage
2121

22-
const upperFirst = word => word.charAt(0).toUpperCase() + word.slice(1);
23-
const upperCapital = s => s.split(' ').map(upperFirst).join(' ');
24-
const lower = s => s.toLowerCase();
25-
const trim = s => s.trim();
22+
const upperFirst = (word) => word.charAt(0).toUpperCase() + word.slice(1);
23+
const upperCapital = (s) => s.split(' ').map(upperFirst).join(' ');
24+
const lower = (s) => s.toLowerCase();
25+
const trim = (s) => s.trim();
2626

2727
const s = ' MARCUS AURELIUS ';
2828
console.log(s);

JavaScript/6-recursive.js

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

3-
const compose = (...fns) => x => {
3+
const compose = (...fns) => (x) => {
44
if (fns.length === 0) return x;
55
const fn = fns.pop();
66
const res = fn(x);
77
if (fns.length === 0) return res;
88
return compose(...fns)(res);
99
};
1010

11-
const pipe = (...fns) => x => {
11+
const pipe = (...fns) => (x) => {
1212
if (fns.length === 0) return x;
1313
const fn = fns.shift();
1414
const res = fn(x);
@@ -18,10 +18,10 @@ const pipe = (...fns) => x => {
1818

1919
// Usage
2020

21-
const upperFirst = word => word.charAt(0).toUpperCase() + word.slice(1);
22-
const upperCapital = s => s.split(' ').map(upperFirst).join(' ');
23-
const lower = s => s.toLowerCase();
24-
const trim = s => s.trim();
21+
const upperFirst = (word) => word.charAt(0).toUpperCase() + word.slice(1);
22+
const upperCapital = (s) => s.split(' ').map(upperFirst).join(' ');
23+
const lower = (s) => s.toLowerCase();
24+
const trim = (s) => s.trim();
2525

2626
const s = ' MARCUS AURELIUS ';
2727
console.log(s);

JavaScript/7-compose-async.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const reduceAsync = (items, performer, done, initialValue) => {
2222
performer(previous, current, response, counter, items);
2323
};
2424

25-
const last = arr => arr[arr.length - 1];
25+
const last = (arr) => arr[arr.length - 1];
2626

2727
// funcs - array of parametrs for functions
2828
// args - array of functions
@@ -40,9 +40,9 @@ const composeAsync = (funcs, ...args) => (
4040

4141
// Usage
4242

43-
const randomize = max => Math.floor((Math.random() * max));
43+
const randomize = (max) => Math.floor((Math.random() * max));
4444

45-
const wrapAsync = callback => setTimeout(callback, randomize(1000));
45+
const wrapAsync = (callback) => setTimeout(callback, randomize(1000));
4646

4747
const read = (file, charset, callback) => {
4848
console.dir({ read: { file, callback } });

JavaScript/8-compose-proto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ AddOnlySet.prototype.toString = function() {
2525
// Usage
2626

2727
const s1 = new AddOnlySet(['uno', 'due']);
28-
s1.on('add', value => console.log(`Added "${value}"`));
28+
s1.on('add', (value) => console.log(`Added "${value}"`));
2929
s1.add('tre');
3030
console.dir({ result: s1.toString() });

0 commit comments

Comments
 (0)