Skip to content

Commit f2c84ca

Browse files
authored
Create compose.js
1 parent 5f4d586 commit f2c84ca

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

compose.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const compose = (...fns) => (input) => {
2+
return fns.reduce((result,fn) => fn(result),input);
3+
}
4+
5+
const toLowerCase = (input) => {
6+
return input.toLowerCase();
7+
}
8+
9+
const removeSpaces = (input) => {
10+
return input.replace(/\s+/,"");
11+
}
12+
13+
const input = "Varun Hegde";
14+
15+
console.log(compose(toLowerCase,removeSpaces)(input));

0 commit comments

Comments
 (0)