Спасибо Владимир, помогло!
From: [email protected]
[mailto:[email protected]] On Behalf Of Vladimir Tkach
Sent: Thursday, October 29, 2009 3:02 PM
To: [email protected]
Subject: [Proto-Scripty] Re: Help me with hashes
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 <[email protected]>
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
[email protected]
http://teamco-anthill.blogspot.com/
http://www.google.com/search?q=teamco-anthill
<http://www.google.com/search?q=teamco-anthill&pov=113485037116411478549&usg=__MJmWqpqtgaTxQA8ZMBvE3etiB1Q=>
&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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---