Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append should be renamed to prepend #249

Open
dubiousdavid opened this issue Nov 7, 2018 · 4 comments
Open

append should be renamed to prepend #249

dubiousdavid opened this issue Nov 7, 2018 · 4 comments

Comments

@dubiousdavid
Copy link
Member

https://smartprocure.github.io/futil-js/#api-lang-append

Given the order of concatenation is reversed from the order of the arguments, this would be better described as prepend instead of append.

@daedalus28
Copy link
Contributor

I'm not sure that's right - we generally try put the data last with functional APIs since that's what usually varies the most. If the function wasn't curried I'd agree more, but I think from an fp API perspective, you expect it to be (thingToAdd, dataThatGetsAddedTo), just as _.join is (thingToJoinBy, dataToJoin). That would make _.add the actual prepend function, but I'm open to discussion. Thoughts?

@dubiousdavid
Copy link
Member Author

I think _.merge is a good point of reference here. The ordering is consistent across lodash and lodash/fp because a reversed ordering for lodash/fp would be counterintuitive.

@daedalus28
Copy link
Contributor

That makes sense and I'm ok with this, but it's a breaking change and should probably wait for a 2.0 release with a few more changes. Alternatively, we might just want to deprecate F.append(x) in favor of _.add(_, x) which is the same number of characters and doesn't introduce a new method name.

@dubiousdavid
Copy link
Member Author

I'd love to have both append and prepend, as add does not convey the concatenation of strings very well and does not always return a string, which append and prepend should/would. Definitely a breaking change to remedy the current naming so a 2.0 release makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants