Aliases (chain = flatMap) #1844
Closed
angelhdzdev
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
The choice dates back a few years ago when the only specification regarding functional programming in JavaScript was [fantasy land].(https://github.com/fantasyland/fantasy-land) Regarding |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi.
I just learned about this library, and I got interested, but when I was watching a tutorial on YouTube, the author explained the chain function as a replacement for map, that flattens the options, and the author wrote "flatMap" to explain it better.
So I wondered "why is it named chain instead of flatMap?". I prefer consistency and this is bit of annoying.
And then I wondered what other stuff is being named in a non consistent way.
I'm just trying to understand the logic behind the naming decisions, not bringing negativity. I am really hyped for this library.
So my suggestion is, if due to backward compatibility there's no chance of renaming it, then is it possible to just tree-shake-import the aliases, so we can use flatMap instead of chain? Many libraries have aliases.
pipe is already associated with chain, chainable functions.
flatMap sounds more like what Array.flat does.
Any kind response will be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions