-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collections in grouper object #12
Comments
Thanks for your first PR. I will implement this tomorrow. Out of interest, what's the benefit of grouping your collections? |
It keeps the |
@aldeed Could you share the snippet or method you use for parsing strings with '.' to return JS objects? |
function lookup(obj) {
var ref = window;
var arr;
if (typeof obj === "string") {
arr = obj.split(".");
while(arr.length && (ref = ref[arr.shift()]));
if (!ref) {
throw new Error(obj + " is not in the window scope");
}
return ref;
}
return obj;
} That takes either the object itself or a string representation of it with dots. If it's an object, just returns it, otherwise lookup based on the string pieces. It's client-specific, though, so if used in server code, you'd have to detect whether client or server, and change that first line to |
I usually group my collections in an object:
This doesn't seem to be supported since you use the property name as the collection. Maybe just allow an override:
(Trying out the package on a new project. Will probably submit lots of issues, but I can try to help with PRs when I have time. Seems really good so far.)
The text was updated successfully, but these errors were encountered: