rh / lodash-rails

lodash for the Rails asset pipeline
MIT License
75 stars 10 forks source link

Lodash methods return lodash wrapper not an array #1

Closed alexkravets closed 11 years ago

alexkravets commented 11 years ago

_([1,2,3]).reverse() lodash

http://cl.ly/image/2R1A2l0F0I2i Returned object should be an array, or am I missing something?

rh commented 11 years ago

_() creates a lodash object and enables methods chaining. This will also give you some Array methods, including reverse(). See http://lodash.com/docs#_ To simply reverse the array you don't need a lodash object, just use

[1,2,3].reverse()
alexkravets commented 11 years ago

sweet, thanks!