Skip to content

Commit 736984f

Browse files
committed
Fix lint errors in support & add 'append' to exposed functions
1 parent 829844b commit 736984f

File tree

8 files changed

+23
-10
lines changed

8 files changed

+23
-10
lines changed

exercises/ch05/solution_c.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
const append = flip(concat);
2-
31
const fastestCar = compose(
42
append(' is the fastest'),
53
prop('name'),
64
last,
75
sortBy(prop('horsepower')),
86
);
9-

exercises/support.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,15 @@ const always = curry(function always(a, b) { return a; });
669669

670670
/* ---------- Pointfree Classic Utilities ---------- */
671671

672+
const append = curry(function append(a, b) {
673+
assert(
674+
typeof a === 'string' && typeof b === 'string',
675+
typeMismatch('String -> String -> String', [getType(a), getType(b), 'String'].join(' -> '), 'concat'),
676+
);
677+
678+
return b.concat(a);
679+
});
680+
672681
const add = curry(function add(a, b) {
673682
assert(
674683
typeof a === 'number' && typeof b === 'number',
@@ -691,7 +700,7 @@ const eq = curry(function eq(a, b) {
691700
assert(
692701
getType(a) === getType(b),
693702
typeMismatch('a -> a -> Boolean', [getType(a), getType(b), 'Boolean'].join(' -> '), eq),
694-
)
703+
);
695704

696705
return a === b;
697706
});
@@ -1046,6 +1055,7 @@ if (typeof module === 'object') {
10461055
Task,
10471056

10481057
// Currified version of 'standard' functions
1058+
append,
10491059
add,
10501060
chain,
10511061
concat,

exercises/test/ch10.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const { runExercises } = require('../test-utils');
33

44
describe('Exercises Chapter 10', () => {
55
runExercises('ch10');
6-
});
6+
});
7+

exercises/test/ch10.solutions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const { runSolutions } = require('../test-utils');
33

44
describe('Exercises Chapter 10', () => {
55
runSolutions('ch10');
6-
});
6+
});
7+

exercises/test/ch11.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const { runExercises } = require('../test-utils');
33

44
describe('Exercises Chapter 11', () => {
55
runExercises('ch11');
6-
});
6+
});
7+

exercises/test/ch11.solutions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const { runSolutions } = require('../test-utils');
33

44
describe('Exercises Chapter 11', () => {
55
runSolutions('ch11');
6-
});
6+
});
7+

exercises/test/ch12.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const { runExercises } = require('../test-utils');
33

44
describe('Exercises Chapter 12', () => {
55
runExercises('ch12');
6-
});
6+
});
7+

exercises/test/ch12.solutions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const { runSolutions } = require('../test-utils');
33

44
describe('Exercises Chapter 12', () => {
55
runSolutions('ch12');
6-
});
6+
});
7+

0 commit comments

Comments
 (0)