[aerogear-dev] AeroGear.js DataManager Filter Method

Kris Borchers kris at redhat.com
Thu Dec 13 11:52:27 EST 2012


On Dec 13, 2012, at 10:48 AM, Sebastien Blanc <scm.blanc at 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 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
> 
> _______________________________________________
> 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/4e0edc9d/attachment.html 


More information about the aerogear-dev mailing list