Closed amoilanen closed 10 years ago
This PR has bitrotted with the 0.8.0 released. Please rebase and refactor, and resubmit for review (wow that was a lot of "re"s :smile:)
I merged the recent changes :) Can you, please, take a look?
To me this was a bug in my implementation. I have merged your changes and tagged this for release v0.8.1
. Thanks for your contribution!
OK. Thank you!
fn.concat(6, [1, 2, 3])
orfn.concat()
worked differently from how I would expect them to work. In both cases an exception would be thrown. At the same time it is perfectly fine to call standard methods likearr1.concat(6)
andarr1.concat()
, in the first case it will just append6
and in the second case will leave the array unchanged.I added a few test cases covering those corner cases and modified the implementation of
fn.concat
a bit to handle them.Basically I just looked at the following examples for
Array.prototype.concat
andString.prototype.concat
and made sure that the behavior is similar forfn.concat
:By the way, I assumed that
fn.concat
should also work with strings, not only arrays.Please, let me know if you have any notes or suggestions.