[aerogear-dev] AeroGear.js DataManager Filter Method

Sebastien Blanc scm.blanc at gmail.com
Thu Dec 13 11:48:09 EST 2012


Hi,
I'm not really confortable with the double dot, but I have no other idea
for the moment :) (maybe '->' ?).
And should your pseudo code not be written this way :

var filtered = filter({
        "x.sites.'google.com'.type": {
                data:  "search engine"
        }
});

?
Seb



On Thu, Dec 13, 2012 at 5:22 PM, Kris Borchers <kris at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20121213/ff04d815/attachment-0001.html 


More information about the aerogear-dev mailing list