13 650
правок
Изменения
Добавлена закладка Catalog of Patterns of Enterprise Application Architecture
=== Январь 2011 ===
* 21 Январь, 16:43:29: [http://martinfowler.com/eaaCatalog/ Catalog of Patterns of Enterprise Application Architecture]
* 20 Январь, 19:15:14: [http://snowcore.net/clone-javascript-object Clone Javascript object > Snowcore’s блог]
*: <html><span style="font-weight: bold; color: #003366;">function</span> clone<span style="color: #66cc66;">(</span>o<span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span><br> <span style="font-weight: bold; color: #000066;"> if</span><span style="color: #66cc66;">(</span>!o || <span style="color: #3366cc;">‘object’</span> !== <span style="font-weight: bold; color: #000066;">typeof</span> o<span style="color: #66cc66;">)</span> <span style="color: #66cc66;"> {</span><br> <span style="font-weight: bold; color: #000066;"> return</span> o;<br> <span style="color: #66cc66;"> }</span><br> <span style="font-weight: bold; color: #003366;"> var</span>c = <span style="color: #3366cc;">‘function’</span> === <span style="font-weight: bold; color: #000066;">typeof</span> o.<span style="color: #006600;">pop</span> ? <span style="color: #66cc66;">[</span><span style="color: #66cc66;">]</span> : <span style="color: #66cc66;">{</span><span style="color: #66cc66;">}</span>;<br> <span style="font-weight: bold; color: #003366;"> var</span> p, v;<br> <span style="font-weight: bold; color: #000066;"> for</span><span style="color: #66cc66;">(</span>p <span style="font-weight: bold; color: #000066;">in</span> o<span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span><br> <span style="font-weight: bold; color: #000066;"> if</span><span style="color: #66cc66;">(</span>o.<span style="color: #006600;">hasOwnProperty</span><span style="color: #66cc66;">(</span>p<span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span><br> v = o<span style="color: #66cc66;">[</span>p<span style="color: #66cc66;">]</span>;<br> <span style="font-weight: bold; color: #000066;"> if</span><span style="color: #66cc66;">(</span>v && <span style="color: #3366cc;">‘object’</span> === <span style="font-weight: bold; color: #000066;">typeof</span> v<span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span><br> c<span style="color: #66cc66;">[</span>p<span style="color: #66cc66;">]</span> = clone<span style="color: #66cc66;">(</span>v<span style="color: #66cc66;">)</span>;<br> <span style="color: #66cc66;">}</span><br> <span style="font-weight: bold; color: #000066;"> else</span> <span style="color: #66cc66;">{</span><br> c<span style="color: #66cc66;">[</span>p<span style="color: #66cc66;">]</span> = v;<br> <span style="color: #66cc66;">}</span><br> <span style="color: #66cc66;"> }</span><br> <span style="color: #66cc66;">}</span><br> <span style="font-weight: bold; color: #000066;"> return</span> c;<br> <span style="color: #66cc66;">}</span></html>