I think I will try the object method first. I think I have thought of a way to do it
without too much insanity. We'll see :-P
On Dec 13, 2012, at 11:32 AM, Douglas Campos <qmx(a)qmx.me> wrote:
filter({
site:{
'google.com':false
}
});
On Dec 13, 2012, at 3:26 PM, Kris Borchers wrote:
> Can you elaborate on the "example" object? Not sure what you mean.
>
> On Dec 13, 2012, at 11:24 AM, Douglas Campos <qmx(a)qmx.me> wrote:
>
>> Isn't it possible to provide an "example" object? I understand that
this makes things way harder, but it would solve naturally the "weird key
scenario"
>>
>> On Dec 13, 2012, at 2:54 PM, Kris Borchers wrote:
>>
>>> Although, I wonder if just requiring users to wrap keys with dots in single
quotes would work. I could then check for that instead of some separator. I think I like
that idea better. Any thoughts on that or anything from anyone else?
>>>
>>> On Dec 13, 2012, at 10:52 AM, Kris Borchers <kris(a)redhat.com> wrote:
>>>
>>>>
>>>> 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
>>>>
>>>> _______________________________________________
>>>> 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
>>
>> -- qmx
>>
>>
>> _______________________________________________
>> 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
-- qmx
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev