On 9/16/06, Juergen Schreck <[EMAIL PROTECTED]> wrote: > > Docs aren't helping me on this one. I have: > > var foo = {'item_no' : '185-N', 'name': 'Chair'}; > var bar = {'item_no' : '185-N', 'name': 'Bed'}; > > compare(foo,bar) gives "[object Object] and [object Object] can not > be compared" > > objCompare does the same thing. > > My main question: what do I do to compare stuff like this?
Write your own comparator, or compare something like sorted(items(obj)). It's intentional that MochiKit doesn't define a comparator for arbitrary objects that it doesn't know anything about. > Further, I need something that gives me the difference of two objects > in form of: > > findDifference(foo, bar) would return {'name':'Bed'} > > and > > findDifference(bar, foo) would return {'name':'Chair'} MochiKit doesn't currently implement anything like that. > > I know there's probably nothing in the MB stock that does this, but I > assume it has some useful functions that can assist me in making my > code shorter. Any hints would be greatly appreciated. I doubt you'd really want to use much from MochiKit to implement that, other than compare. It's pretty basic stuff otherwise. -bob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~----------~----~----~----~------~----~------~--~---