peerlibrary / meteor-blaze-components

Reusable components for Blaze
http://components.meteorapp.com/
BSD 3-Clause "New" or "Revised" License
354 stars 26 forks source link

constructor arguments always gets Spacebars.kw, even if no "foo=bar" style arguments. #123

Open JesperWe opened 8 years ago

JesperWe commented 8 years ago

When a component is included using {{> component args 'foo' 'bar' }} style, the constructor is called something like this: component.constructor( 'foo', 'bar', new Spacebars.kw() )

This caused me a bit of confusion when I wanted an optional last argument to the constructor, since omitting it from the template instanciation did not make it undefined, but rather gave me the empty Spacebars keyword hash.

I thing either the hash should not be in the argument list if it is empty, or the docs should say that it is always the last argument, to avoid similar confusion in the future.

mitar commented 8 years ago

Because this is also how template helpers in general operate (so all class methods) I think I will go with documenting this instead of changing the behavior. But I agree it is ugly.