"Namespacing" or "Scoping" method names


#1

Wondering what the best practice is for the following situation;

Say I have staff and projects; both of them have an insert method. Say I then have a page where you can create both staff and projects. I then import { insert } from 'path/to/staff.js', but can’t also import { insert } from 'path/to/projects.js, so what’s the best practice for separating two methods of the same name?

I mean ideally, something like Staff.insert and Projects.insert makes the most sense to me, but I’m not sure how to do that while retaining the Meteor 1.3 best practices.


#2

The approach I took for Meteor Collections was to put them into the collection, but because of technical limitations, I cannot use insert, update, remove.

I also wrap the collection in its own class.


#3

Interesting, thanks!


#4

http://github.com/trajano/meteor-boilerplate provides a sample implementation of this if you need to see it in action.