On 8/19/06, Chris Nokleberg <[EMAIL PROTECTED]> wrote: > > While working with MochiKit I've accumulated a bunch of helper methods. > It's possible that there is already a better way to do some of these > things, which I'd be grateful to learn. Anyway, feel free to adopt or > improve them if they seem useful. > > 1) I discovered that if you Base.clone an object then try to delete a > property it doesn't work as expected (the copy-on-write magic of clone > makes this impossible). Here is an eagerly copying version, which uses > a subset helper method which is useful in its own right:
If you want a copy, use merge(obj). > 2) I use Base.keys all the time, so the lack of a values method was > surprising: I never really had any use cases for values without items. Do you have any? > 3) Similarly, a way to reverse the effect of Base.items is useful. With > it you can write methods to "map" just the values of an object: This we could use. I don't know about the extra map functions though. > 4) This one is a little more random--rotating an array in either > direction: Does anyone else think this is useful? The only time I've ever used a pattern like this is when doing array.push(array.shift()) or vice versa. I'm not sure it warrants an extra function. -bob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" 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/mochikit -~----------~----~----~----~------~----~------~--~---
