matb33/meteor-collection-hooks — pull request #24 by aldeed (2014-01-15 17:47:12+00:00)
Title: assume insert callback is last arg instead of second

This tiny change fixes an issue I'm having with my package, collection2. C2 overrides Meteor.Collection in a similar way to collection-hooks, but it adds support for `options` as the second argument of `insert`. It removes the options argument before passing to the real `insert`. However, it seems that Meteor always loads collection-hooks after collection2, which means that the collection-hooks `insert` method is run first, and it is confused by `args[1]` not being a function.

This simple change uses the last argument instead of the second argument, which is more future-proof coding anyway.

aldeed/meteor-collection2#50