Better Programming

Advice for programmers.

Follow publication

Member-only story

Functional Programming and the Pipe Function in JavaScript

Moon
Better Programming
Published in
6 min readDec 13, 2019

Photo by JOHN TOWNER on Unsplash

When you want to do something but it’s quite complex to be in one function, how do you solve this problem? What if you want to separate the function into many pieces but you want to do something more elegantly?

There’s an interesting proposal on TC39 GitHub — proposal-pipeline-operator at stage 1. Although it’s still unsettled as it’s mentioning, the idea of the proposal is quite fun to take a look at.

In this post, I will talk about pipe or pipeline which is important when it comes to functional programming and how to write them.

Before Reading

This post is under the premise that you are aware of JavaScript basics and some of the built-in methods in the Array.prototype.

If you aren’t familiar with those, I recommend you read the documentation about them. And, the way I make pipeline functions might be different from other pipelines in the JavaScript world. But the core concept wouldn’t be so different.

Plus, I will explain pipe and how to create it step-by-step for people who have no idea about it.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Moon
Moon

Written by Moon

Frontend React w/ Typescript developer based in S.Korea. Interested in UX/Testing/FE. mgyang95@gmail.com

Write a response