var MyObj={
 obj1:{
  prop: ['А', 'C', 'D', 'E']
 },
 obj2:{
  prop: ['B', 'C', 'D', 'E']
 },
 obj3:{
  prop: ['А',  'E']
 },
 obj4:{
  prop: ['D', 'E']
 }
}
var newObj = {}

Object.keys(MyObj).each(function(k,v){
    MyObj[k].prop.each(function(x,y){
        if(typeof newObj[x]=="undefined"){newObj[x]=[]}
        newObj[x].push(k)
    })

})

newObj

2009/10/29 Buda <budari...@gmail.com>

>
> Help me please, this operation is best
>
> I have an object
>
> var MyObj:{
>  obj1:{
>   ...
>   prop: ['А', 'C', 'D', 'E']
>   ...
>  },
>  obj2:{
>   ...
>   prop: ['B', 'C', 'D', 'E']
>   ...
>  },
>  obj3:{
>   ...
>   prop: ['А',  'E']
>   ...
>  },
>  obj4:{
>   ...
>   prop: ['D', 'E']
>   ...
>  }
> }
>
>
> I neet to get a new hash like this
>
> Props:{
>  A: ['obj1', 'obj3'],
>  B: ['obj2'],
>  C: ['obj1', 'obj2'],
>  D: ['obj1', 'obj2', 'obj4'],
>  E: ['obj1', 'obj2', 'obj3', 'obj4'],
> }
> >
>


-- 
Best Regards,
Vladimir Tkach

+972-54-7574166
tea...@gmail.com

http://teamco-anthill.blogspot.com/

http://www.google.com/search?q=teamco-anthill&pov=113485037116411478549&usg=__MJmWqpqtgaTxQA8ZMBvE3etiB1Q=

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to