On 9/19/06, Juergen Schreck <[EMAIL PROTECTED]> wrote:
>
> I just want to chime in again and report that MK at least makes it
> very easy for me to compare the objects.
>
> Based on my original example I can do:
>
> var  foo = {'item_no' : '185-N', 'name': 'Chair'};
> var bar = {'item_no' : '185-N', 'name': 'Bed'};
>
> arrayEqual(items(foo), items(bar)); // will tell you if they're equal.
>
> Now I just gotta write the 'difference' code. :-)

You really want to sort the items.. there's absolutely no guaranteed
ordering for properties. I'd probably also just use compare instead of
arrayEqual.

if (compare(sorted(items(foo)), sorted(items(bar))) === 0) {
    /* equal */
}

-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
-~----------~----~----~----~------~----~------~--~---

Reply via email to