Closed srdjan closed 9 years ago
I was asking myself the same question when developing the library at the beginning. I remember I chose push
and unshift
to stick to react immutability helpers' specs.
I will consider adding aliases in a near future.
cool! thank you... btw, will publish Baobab Todo App (https://dl.dropboxusercontent.com/u/51491957/todo-app-baobab/index.html) in a few... if you get a chance, let me know if I missed something big :)
@christianalfoni, @jacomyal, any opinion on this: alias? replacing push and unshift? nothing?
Hm,
Personally I favor using native method names. Because you are working with a plain array, as you will in other parts of your code. append/prepend implies that it does something different than the native methods. I really do not like for example BaconJS creating a scan method, when it is just reduce... but I suppose it is more entitled to because it is an observable. In Baobab though it is just a plain array you are working on.
It also makes the API more complex, because you have to favor one flavor in the documentation and then the other aliases will get lost... unless you have a specific alias section. But yeah. I think it is better to enforce native methods, than having better names or your code will be more complex because sometimes you use push/unshift on native arrays, but append/prepend on Baobab arrays... but they are both just arrays.
But yeah, I like append/prepend better for understanding, but I like consistency even more ;-) Just my 2 cents though!
maybe 'append' vs 'push' and 'prepend' vs 'unshift'
probably nitpicking :) - great little lib - congrats!