On Dec 13, 2012, at 10:48 AM, Sebastien Blanc <scm.blanc(a)gmail.com> wrote:
Hi,
I'm not really confortable with the double dot, but I have no other idea for the
moment :) (maybe '->' ?).
Hmm, the arrows have too much baggage (arrows in typescript and coffeescript, the fat
arrow (=>) making it into es6). Not sure I want to go down that path.
And should your pseudo code not be written this way :
var filtered = filter({
"x.sites.'google.com'.type": {
data: "search engine"
}
});
?
I don't think so. That would still not work and the point was to show that the dots
would really mess stuff up.
Seb
On Thu, Dec 13, 2012 at 5:22 PM, Kris Borchers <kris(a)redhat.com> wrote:
Hey all, I am trying to enhance the filter method to be able to filter objects based on
values nested inside other objects inside that main object. My first thought was just to
use dot notation to specify the field we are filtering on but that runs into issues if the
key actually has a "." in it like this:
var x = {
sites: {
"google.com": {
type: "search engine"
}
}
}
Trying to traverse that object via:
// pseudocode
var filtered = filter({
"x.sites.google.com.type": {
data: "search engine"
}
});
would fail. I'm wondering if we should just define our own separator for the path
through the object. We could use ".." (double-dot) which I think should work so
something like:
// pseudocode
var filtered = filter({
"x..sites..google.com..type": {
data: "search engine"
}
});
Then I can separate on ".." and parse that way. Thoughts?
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev