Uma rápida introdução ao tubo e compor JavaScript
// pipe can be used to streamline the chaining of method calls
// Reference: https://www.freecodecamp.org/news/pipe-and-compose-in-javascript-5b04004ac937/
getName = (person) => person.name; // first method
uppercase = (string) => string.toUpperCase(); // second method
get6Characters = (string) => string.substring(0, 6); // third method
reverse = (string) =>
string
.split('')
.reverse()
.join(''); // fourth method
pipe(
getName,
uppercase,
get6Characters,
reverse
)({ name: 'Buckethead' }); // create a to do list of functions
// Output: 'TEKCUB'
Wissam