[Prototype-core] Safe Object.extend?
How would the core feel about a safe version of Object.extend? Object.extend = function(destination, source, safe) { safe = !!safe || false; for (var property in source){ destination[property] = (safe typeof destination[property] !== 'undefined') ? destination[property] : source[property]; } return destination; }; Existing functionality is covered (safe defaults false, which goes to source[property], no need to change anything. i found a recent need to extend a class object after it had been created, but i didn't want to overwrite properties if they'd already been defined. i imagine there would be some minimal performance hit testing each property if safe==true, but otherwise...? Any visible problems? Just a suggestion, it helped me out. -joe t. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Safe Object.extend?
http://gist.github.com/44308 I'd probably suggest another method, though, rather than adding a flag to Object.extend. Best, Tobie On Jan 7, 3:45 pm, joe t. thooke...@gmail.com wrote: How would the core feel about a safe version of Object.extend? Object.extend = function(destination, source, safe) { safe = !!safe || false; for (var property in source){ destination[property] = (safe typeof destination[property] !== 'undefined') ? destination[property] : source[property]; } return destination; }; Existing functionality is covered (safe defaults false, which goes to source[property], no need to change anything. i found a recent need to extend a class object after it had been created, but i didn't want to overwrite properties if they'd already been defined. i imagine there would be some minimal performance hit testing each property if safe==true, but otherwise...? Any visible problems? Just a suggestion, it helped me out. -joe t. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Prototype in French
I don't think there is a branch for this because there is nothing to translate in the code lol I have created this Wiki if you want helping me : http://www.celine-cyril.eu/proto/doku.php If you want an account you can ask to me. By default you cannot create a page in anonymous but you can comment the different page created. See you soon ! - Cyril Charlier cyril.charl...@gmail.com -- Afin de contribuer au respect de l'environnement, merci de n'imprimer cet e-mail que si nécessaire On Wed, Jan 7, 2009 at 00:43, Simon Charette charett...@gmail.com wrote: Is there a i18n branch planed for protodoc? 2009/1/6, CHARLIER Cyril cyril.charl...@gmail.com: Hi ! thanks for your help, I will make a site for this (a wiki). -- Cyril Charlier cyril.charl...@gmail.com -- Afin de contribuer au respect de l'environnement, merci de n'imprimer cet e-mail que si nécessaire On Tue, Jan 6, 2009 at 01:01, Simon Charette charett...@gmail.com wrote: Well I might be interested to help you translate the doc to french also. 2009/1/5 Christophe Porteneuve t...@tddsworld.com Sébastien Gruhier a écrit : TTD's book is a great book in French http://www.eyrolles.com/Informatique/Livre/bien-developper-pour-le-web-2-0-9782212123913 :) TDD, man. Although I'm discontinuing the nickname :-) Also, the book is a great French resource, but in its 2nd edition, which is up-to-date on 1.6.0.2 (the first edition was geared towards 1.5.0). -- Christophe Porteneuve aka TDD t...@tddsworld.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Prototype in French
Ok thansk for the reply. So if we want to participate in this way to translate the doc How can we do ? Best, -- Cyril Charlier On Wed, Jan 7, 2009 at 21:29, Tobie Langel tobie.lan...@gmail.com wrote: FYI: We're planning on migrating the docs inline. Link up with Samuel Lebeau, he's been doing a lot of work on this recently in his own branch. Best, Tobie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---