Skip to content

Commit e6906fa

Browse files
chore: pipe function
1 parent b441a7e commit e6906fa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/callbacks.md

+10
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,14 @@ function uppercase(input) {
359359
function reverse(input) {
360360
return input.split("").reverse().join("");
361361
}
362+
363+
function pipe(...outerArguments) {
364+
return function (innerArguments) {
365+
return outerArguments.reduce((currentValue, currentFunction) => {
366+
return currentFunction(currentValue);
367+
}, innerArguments);
368+
};
369+
}
370+
371+
pipe(getName, uppercase, reverse)({ name: "Abhishek" });
362372
```

0 commit comments

Comments
 (0)