Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
657 stars 92 forks source link

Correctly check if parameter is an empty array #206

Closed manzato closed 7 years ago

manzato commented 7 years ago

Fixes #203

matb33 commented 7 years ago

Looks like insert.js, upsert.js, and remove.js could benefit from these same checks. Quickly scanning through, looks like these are other potential areas to check for not isEmpty:

https://github.com/matb33/meteor-collection-hooks/blob/master/insert.js#L45 https://github.com/matb33/meteor-collection-hooks/blob/master/upsert.js#L25 https://github.com/matb33/meteor-collection-hooks/blob/master/upsert.js#L31 https://github.com/matb33/meteor-collection-hooks/blob/master/upsert.js#L45 https://github.com/matb33/meteor-collection-hooks/blob/master/upsert.js#L56 https://github.com/matb33/meteor-collection-hooks/blob/master/upsert.js#L74 https://github.com/matb33/meteor-collection-hooks/blob/master/remove.js#L18 https://github.com/matb33/meteor-collection-hooks/blob/master/remove.js#L23

zimme commented 7 years ago

I've cherry-picked this commit and added some more checks where I could find code doing unnecessary document fetching.

Thank you for the PR. ❤️