Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

0.2.5 _.deep

  • Loading branch information...
commit 60b929a0a9660e92cdf9c47d54fc5d46f1e3490e 1 parent 1302ece
@DavidSouther authored
View
41 dist/superscore.js
@@ -1,8 +1,8 @@
-// superscore - v0.2.4.1 - 2012-06-18
+// superscore - v0.2.5 - 2012-06-19
// https://github.com/DavidSouther/superscore
// Copyright (c) 2012 David Souther; Licensed MIT
-// superscore core.js 0.2.4
+// superscore core.js 0.2.5
// (c) 2012 David Souther
// superscore is freely distributable under the MIT license.
// For all details and documentation:
@@ -13,7 +13,7 @@
// Missing from Underscore.
_.mixin({
- // ## indexBy*(list, func)*
+ // ### indexBy*(list, func)*
// The default underscore indexOf uses a literal value; we often want to use an comparator. This function returns the index of the first element in the list that the comparator returns truthy when evaluating, or -1 if no elements match.
indexBy: function(list, func) {
list = list || []; func = func || function(){return false;};
@@ -23,7 +23,7 @@ _.mixin({
return -1;
},
- // ## noop
+ // ### noop
noop: function(){},
// ### symmetricDifference*(set1, set2[, ...setN])*
@@ -36,6 +36,39 @@ _.mixin({
_.difference(second, first)
);
});
+ },
+
+ // ### deep*(object, path[, value[, overwrite]])*
+ // Follow a path deep into an object, creating intermediate objects or arrays as necessary.
+ // If value is specified, sets the value of that key if unset. If overwrite is true, sets
+ // even if the value is already set. Returns the root object on set, or the current value
+ // on get.
+ deep: function(object, path, value, overwrite){
+ overwrite = overwrite || false;
+ value = value || null;
+
+ // Break the path, if it's not already an array.
+ path = _.isString(path) ? path.split('.') : _.isArray(path) ? path : [];
+ // Get the next step
+ var part = path.shift();
+ // Different behavior depending on if we're at the last step
+ if(path.length) {
+ // More children, so make sure there's a container at the next level
+ if(!object[part]){
+ object[part] = !_.isNaN(+path[0]) ? [] : {};
+ }
+ // Recurse, returning either the object or the old value
+ var next = _.deep(object[part], path, value, overwrite);
+ return value ? object : next;
+ } else {
+ // If no value, return the part.
+ if(!value){
+ return object[part];
+ } else {
+ object[part] = overwrite ? value : (object[part] || value);
+ return object;
+ }
+ }
}
});
View
4 dist/superscore.min.js
@@ -1,4 +1,4 @@
-// superscore - v0.2.4.1 - 2012-06-18
+// superscore - v0.2.5 - 2012-06-19
// https://github.com/DavidSouther/superscore
// Copyright (c) 2012 David Souther; Licensed MIT
-(function(a,b){"use strict",a.mixin({indexBy:function(a,b){a=a||[],b=b||function(){return!1};for(var c=0,d=a.length;c<d;c++)if(b(a[c]))return c;return-1},noop:function(){},symmetricDifference:function(){return a.reduce(arguments,function(b,c){return a.union(a.difference(b,c),a.difference(c,b))})}}),a._extend=a.extend;var c=Object.prototype.hasOwnProperty;a.extend=function(){var b,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!a.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((b=arguments[i])!==null)for(c in b){d=h[c],e=b[c];if(h===e)continue;k&&e&&(a.isPlainObject(e)||(f=a.isArray(e)))?(f?(f=!1,g=d&&a.isArray(d)?d:[]):g=d&&a.isPlainObject(d)?d:{},h[c]=a.extend(k,g,e)):e!==undefined&&(h[c]=e)}return h},a.isPlainObject=function(b){if(!b||!a.isObject(b)||b.nodeType||a.isWindow(b))return!1;try{if(b.constructor&&!c.call(b,"constructor")&&!c.call(b.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}var e;for(e in b);return e===undefined||c.call(b,e)},a.isWindow=b?b.isWindow:function(a){return a!==null&&a===a.window}}).call(this,_,jQuery||null),function(a){var b={},c=function(a){return c.hash(a,!0)},d={};b.rvalid=/^\{?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{12}\}?$/i,b.v4=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a==="x"?b:b&3|8;return c.toString(16)})},b.v5=function(a,b){var d=e(b||"00000000-0000-0000-0000-000000000000"),f=c.hash(d+a,!0),g=f.substring(0,8)+"-"+f.substring(8,12)+"-"+(parseInt(f.substring(12,16),16)&4095|20480).toString(16)+"-"+(parseInt(f.substring(16,20),16)&16383|32768).toString(16)+"-"+f.substring(20,32);return g};var e=function(a){if(!a.match(b.rvalid))return!1;var c=a.replace(/[\-{}]/g,""),d="";for(var e=0;e<c.length;e+=2)d+=String.fromCharCode(parseInt(c.charAt(e)+c.charAt(e+1),16));return d};c.hash=function(a,b){var e,f;b=typeof b=="undefined"?!0:b,b&&(a=d.encode(a));var g=[1518500249,1859775393,2400959708,3395469782];a+=String.fromCharCode(128);var h=a.length/4+2,i=Math.ceil(h/16),j=new Array(i);for(e=0;e<i;e++){j[e]=new Array(16);for(var k=0;k<16;k++)j[e][k]=a.charCodeAt(e*64+k*4)<<24|a.charCodeAt(e*64+k*4+1)<<16|a.charCodeAt(e*64+k*4+2)<<8|a.charCodeAt(e*64+k*4+3)}j[i-1][14]=(a.length-1)*8/Math.pow(2,32),j[i-1][14]=Math.floor(j[i-1][14]),j[i-1][15]=(a.length-1)*8&4294967295;var l=1732584193,m=4023233417,n=2562383102,o=271733878,p=3285377520,q=new Array(80),r,s,t,u,v;for(e=0;e<i;e++){for(f=0;f<16;f++)q[f]=j[e][f];for(f=16;f<80;f++)q[f]=c.ROTL(q[f-3]^q[f-8]^q[f-14]^q[f-16],1);r=l,s=m,t=n,u=o,v=p;for(f=0;f<80;f++){var w=Math.floor(f/20),x=c.ROTL(r,5)+c.f(w,s,t,u)+v+g[w]+q[f]&4294967295;v=u,u=t,t=c.ROTL(s,30),s=r,r=x}l=l+r&4294967295,m=m+s&4294967295,n=n+t&4294967295,o=o+u&4294967295,p=p+v&4294967295}return c.toHexStr(l)+c.toHexStr(m)+c.toHexStr(n)+c.toHexStr(o)+c.toHexStr(p)},c.f=function(a,b,c,d){switch(a){case 0:return b&c^~b&d;case 1:return b^c^d;case 2:return b&c^b&d^c&d;case 3:return b^c^d}},c.ROTL=function(a,b){return a<<b|a>>>32-b},c.toHexStr=function(a){var b="",c;for(var d=7;d>=0;d--)c=a>>>d*4&15,b+=c.toString(16);return b},d.encode=function(a){var b=a.replace(/[\u0080-\u07ff]/g,function(a){var b=a.charCodeAt(0);return String.fromCharCode(192|b>>6,128|b&63)});return b=b.replace(/[\u0800-\uffff]/g,function(a){var b=a.charCodeAt(0);return String.fromCharCode(224|b>>12,128|b>>6&63,128|b&63)}),b},d.decode=function(a){var b=a.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,function(a){var b=(a.charCodeAt(0)&15)<<12|(a.charCodeAt(1)&63)<<6|a.charCodeAt(2)&63;return String.fromCharCode(b)});return b=b.replace(/[\u00c0-\u00df][\u0080-\u00bf]/g,function(a){var b=(a.charCodeAt(0)&31)<<6|a.charCodeAt(1)&63;return String.fromCharCode(b)}),b},a.extend(a,{UUID:b,Utf8:d,Sha1:c})}.call(this,_),function(a){function c(a){var c=b[a]={},d,e;a=a.split(/\s+/);for(d=0,e=a.length;d<e;d++)c[a[d]]=!0;return c}var b={},d=Array.prototype.slice;a.Callbacks=function(d){d=d?b[d]||c(d):{};var e=[],f=[],g,h,i,j,k,l,m=function(b){var c,f,g,h,i;for(c=0,f=b.length;c<f;c++)g=b[c],a.isArray(g)?m(g):a.isFunction(g)&&(!d.unique||!o.has(g))&&e.push(g)},n=function(a,b){b=b||[],g=!d.memory||[a,b],h=!0,i=!0,l=j||0,j=0,k=e.length;for(;e&&l<k;l++)if(e[l].apply(a,b)===!1&&d.stopOnFalse){g=!0;break}i=!1,e&&(d.once?g===!0?o.disable():e=[]:f&&f.length&&(g=f.shift(),o.fireWith(g[0],g[1])))},o={add:function(){if(e){var a=e.length;m(arguments),i?k=e.length:g&&g!==!0&&(j=a,n(g[0],g[1]))}return this},remove:function(){if(e){var a=arguments,b=0,c=a.length;for(;b<c;b++)for(var f=0;f<e.length;f++)if(a[b]===e[f]){i&&f<=k&&(k--,f<=l&&l--),e.splice(f--,1);if(d.unique)break}}return this},has:function(a){if(e){var b=0,c=e.length;for(;b<c;b++)if(a===e[b])return!0}return!1},empty:function(){return e=[],this},disable:function(){return e=f=g=undefined,this},disabled:function(){return!e},lock:function(){return f=undefined,(!g||g===!0)&&o.disable(),this},locked:function(){return!f},fireWith:function(a,b){return f&&(i?d.once||f.push([a,b]):(!d.once||!g)&&n(a,b)),this},fire:function(){return o.fireWith(this,arguments),this},fired:function(){return!!h}};return o},a.Deferred=function(b){var c=a.Callbacks("once memory"),d=a.Callbacks("once memory"),e=a.Callbacks("memory"),f="pending",g={resolve:c,reject:d,notify:e},h={done:c.add,fail:d.add,progress:e.add,state:function(){return f},isResolved:c.fired,isRejected:d.fired,then:function(a,b,c){return i.done(a).fail(b).progress(c),this},always:function(){return i.done.apply(i,arguments).fail.apply(i,arguments),this},pipe:function(b,c,d){return a.Deferred(function(e){a.each({done:[b,"resolve"],fail:[c,"reject"],progress:[d,"notify"]},function(b,c){var d=b[0],f=b[1],g;a.isFunction(d)?i[c](function(){g=d.apply(this,arguments),g&&a.isFunction(g.promise)?g.promise().then(e.resolve,e.reject,e.notify):e[f+"With"](this===i?e:this,[g])}):i[c](e[f])})}).promise()},promise:function(a){if(!a)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;return i.done(function(){f="resolved"},d.disable,e.lock).fail(function(){f="rejected"},c.disable,e.lock),b&&b.call(i,i),i},a.when=function(b){function l(a){return function(b){c[a]=arguments.length>1?d.call(arguments,0):b,--h||j.resolveWith(j,c)}}function m(a){return function(b){g[a]=arguments.length>1?d.call(arguments,0):b,j.notifyWith(k,g)}}var c=d.call(arguments,0),e=0,f=c.length,g=new Array(f),h=f,i=f,j=f<=1&&b&&a.isFunction(b.promise)?b:a.Deferred(),k=j.promise();if(f>1){for(;e<f;e++)c[e]&&c[e].promise&&a.isFunction(c[e].promise)?c[e].promise().then(l(e),j.reject,m(e)):--h;h||j.resolveWith(j,c)}else j!==b&&j.resolveWith(j,f?[b]:[]);return k}}.call(this,_),function(a,b){"use strict",a.mixin({on:function(c,d,e){return a.isElement(c)&&b?b(c).on(d,e):(this.isString(c)&&(e=d,d=c,c=this),this.isObject(c.__event_handlers)||(c.__event_handlers={}),d in c.__event_handlers||(c.__event_handlers[d]=a.Callbacks("memory")),c.__event_handlers[d].add(e),this)},once:function(c,d,e){if(a.isElement(c)&&b)return b(c).one(d,e);var f=function(){a.off(c,d,e)};e=a.compose(f,e),this.on(c,d,e)},trigger:function(c,d,e){return a.isElement(c)&&b?b(c).trigger(d,e):(this.isString(c)&&(e=d,d=c,c=this),this.isObject(c.__event_handlers)&&d in c.__event_handlers&&c.__event_handlers[d].fireWith(c,e),this)},off:function(c,d,e){return a.isElement(c)&&b?b(c).off(d,e):(this.isString(c)&&(d=c,c=this),this.isObject(c.__event_handlers)&&d in c.__event_handlers&&c.__event_handlers[d].remove(e),this)}})}.call(this,_,jQuery||null),function(a,b){"use strict";var c=b?b.ajax:function(b){var c,d,e=a.Deferred();return d=window.ActiveXObject||XMLHttpRequest,c=new d("Microsoft.XMLHTTP"),c.open(b.type||(b.data?"POST":"GET"),b.url,!0),"overrideMimeType"in c&&c.overrideMimeType(b.dataType||"text/plain"),c.onreadystatechange=function(){var a;if(c.readyState===4){(a=c.status)===0||a===200?e.resolve(c.responseText):e.reject(new Error("Could not load "+b.url));return}e.notify(c)},b.data&&(c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.setRequestHeader("Content-length",b.data.length),c.setRequestHeader("Connection","close")),c.send(b.data||null),e.promise()},d=b?b.get:function(b,c){return c=c||{},c.url=b,c.type="GET",c.data=null,a.ajax(c)},e=b?b.post:function(b,c){return c=c||{},c.url=b,c.type="POST",a.ajax(c)};a.mixin({ajax:c,get:d,post:e})}.call(this,_,jQuery||null);
View
54 docs/core.html
@@ -1,10 +1,10 @@
-<!DOCTYPE html> <html> <head> <title>core.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="ajax.html"> ajax.js </a> <a class="source" href="core.html"> core.js </a> <a class="source" href="deferred.html"> deferred.js </a> <a class="source" href="pubsub.html"> pubsub.js </a> <a class="source" href="uuid.html"> uuid.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> core.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <pre><code>superscore core.js 0.2.4
+<!DOCTYPE html> <html> <head> <title>core.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="ajax.html"> ajax.js </a> <a class="source" href="core.html"> core.js </a> <a class="source" href="deferred.html"> deferred.js </a> <a class="source" href="pubsub.html"> pubsub.js </a> <a class="source" href="uuid.html"> uuid.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> core.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <pre><code>superscore core.js 0.2.5
(c) 2012 David Souther
superscore is freely distributable under the MIT license.
For all details and documentation:
https://github.com/DavidSouther/superscore
</code></pre> </td> <td class="code"> <div class="highlight"><pre><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">_</span><span class="p">,</span> <span class="nx">$</span><span class="p">){</span>
-<span class="s2">&quot;use strict&quot;</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Missing from Underscore.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">_</span><span class="p">.</span><span class="nx">mixin</span><span class="p">({</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <h2>indexBy<em>(list, func)</em></h2>
+<span class="s2">&quot;use strict&quot;</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Missing from Underscore.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">_</span><span class="p">.</span><span class="nx">mixin</span><span class="p">({</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <h3>indexBy<em>(list, func)</em></h3>
<p>The default underscore indexOf uses a literal value; we often want to use an comparator. This function returns the index of the first element in the list that the comparator returns truthy when evaluating, or -1 if no elements match.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">indexBy</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">list</span><span class="p">,</span> <span class="nx">func</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">list</span> <span class="o">=</span> <span class="nx">list</span> <span class="o">||</span> <span class="p">[];</span> <span class="nx">func</span> <span class="o">=</span> <span class="nx">func</span> <span class="o">||</span> <span class="kd">function</span><span class="p">(){</span><span class="k">return</span> <span class="kc">false</span><span class="p">;};</span>
@@ -12,7 +12,7 @@
<span class="k">if</span> <span class="p">(</span><span class="nx">func</span><span class="p">(</span><span class="nx">list</span><span class="p">[</span><span class="nx">i</span><span class="p">])){</span> <span class="k">return</span> <span class="nx">i</span><span class="p">;</span> <span class="p">}</span>
<span class="p">}</span>
<span class="k">return</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
- <span class="p">},</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <h2>noop</h2> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">noop</span><span class="o">:</span> <span class="kd">function</span><span class="p">(){},</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <h3>symmetricDifference<em>(set1, set2[, ...setN])</em></h3>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <h3>noop</h3> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">noop</span><span class="o">:</span> <span class="kd">function</span><span class="p">(){},</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <h3>symmetricDifference<em>(set1, set2[, ...setN])</em></h3>
<p>The symmetric of two sets is is the set of elements in either set, but not their intersection.
If two sets are equal, the symmetric difference is empty.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">symmetricDifference</span><span class="o">:</span> <span class="kd">function</span><span class="p">(){</span>
@@ -22,54 +22,72 @@
<span class="nx">_</span><span class="p">.</span><span class="nx">difference</span><span class="p">(</span><span class="nx">second</span><span class="p">,</span> <span class="nx">first</span><span class="p">)</span>
<span class="p">);</span>
<span class="p">});</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <h3>deep<em>(object, path[, value[, overwrite]])</em></h3>
+
+<p>Follow a path deep into an object, creating intermediate objects or arrays as necessary.
+If value is specified, sets the value of that key if unset. If overwrite is true, sets
+even if the value is already set. Returns the root object on set, or the current value
+on get.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">deep</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">object</span><span class="p">,</span> <span class="nx">path</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">overwrite</span><span class="p">){</span>
+ <span class="nx">overwrite</span> <span class="o">=</span> <span class="nx">overwrite</span> <span class="o">||</span> <span class="kc">false</span><span class="p">;</span>
+ <span class="nx">value</span> <span class="o">=</span> <span class="nx">value</span> <span class="o">||</span> <span class="kc">null</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>Break the path, if it's not already an array.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">path</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isString</span><span class="p">(</span><span class="nx">path</span><span class="p">)</span> <span class="o">?</span> <span class="nx">path</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s1">&#39;.&#39;</span><span class="p">)</span> <span class="o">:</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">path</span><span class="p">)</span> <span class="o">?</span> <span class="nx">path</span> <span class="o">:</span> <span class="p">[];</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Get the next step</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">part</span> <span class="o">=</span> <span class="nx">path</span><span class="p">.</span><span class="nx">shift</span><span class="p">();</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Different behavior depending on if we're at the last step</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">length</span><span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>More children, so make sure there's a container at the next level</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">object</span><span class="p">[</span><span class="nx">part</span><span class="p">]){</span>
+ <span class="nx">object</span><span class="p">[</span><span class="nx">part</span><span class="p">]</span> <span class="o">=</span> <span class="o">!</span><span class="nx">_</span><span class="p">.</span><span class="nb">isNaN</span><span class="p">(</span><span class="o">+</span><span class="nx">path</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">?</span> <span class="p">[]</span> <span class="o">:</span> <span class="p">{};</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>Recurse, returning either the object or the old value</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">next</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">deep</span><span class="p">(</span><span class="nx">object</span><span class="p">[</span><span class="nx">part</span><span class="p">],</span> <span class="nx">path</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">overwrite</span><span class="p">);</span>
+ <span class="k">return</span> <span class="nx">value</span> <span class="o">?</span> <span class="nx">object</span> <span class="o">:</span> <span class="nx">next</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">&#182;</a> </div> <p>If no value, return the part.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">value</span><span class="p">){</span>
+ <span class="k">return</span> <span class="nx">object</span><span class="p">[</span><span class="nx">part</span><span class="p">];</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="nx">object</span><span class="p">[</span><span class="nx">part</span><span class="p">]</span> <span class="o">=</span> <span class="nx">overwrite</span> <span class="o">?</span> <span class="nx">value</span> <span class="o">:</span> <span class="p">(</span><span class="nx">object</span><span class="p">[</span><span class="nx">part</span><span class="p">]</span> <span class="o">||</span> <span class="nx">value</span><span class="p">);</span>
+ <span class="k">return</span> <span class="nx">object</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
<span class="p">}</span>
-<span class="p">});</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <h2>Underscore Utilities</h2> </td> <td class="code"> <div class="highlight"><pre><span class="nx">_</span><span class="p">.</span><span class="nx">_extend</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">;</span>
-<span class="kd">var</span> <span class="nx">hasOwn</span> <span class="o">=</span> <span class="nb">Object</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <h3>Underscore's extend doesn't do deep extension. Use jQuery's (^c/^v from jQuery core).</h3> </td> <td class="code"> <div class="highlight"><pre><span class="nx">_</span><span class="p">.</span><span class="nx">extend</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+<span class="p">});</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">&#182;</a> </div> <h2>Underscore Utilities</h2> </td> <td class="code"> <div class="highlight"><pre><span class="nx">_</span><span class="p">.</span><span class="nx">_extend</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">;</span>
+<span class="kd">var</span> <span class="nx">hasOwn</span> <span class="o">=</span> <span class="nb">Object</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">&#182;</a> </div> <h3>Underscore's extend doesn't do deep extension. Use jQuery's (^c/^v from jQuery core).</h3> </td> <td class="code"> <div class="highlight"><pre><span class="nx">_</span><span class="p">.</span><span class="nx">extend</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">options</span><span class="p">,</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">src</span><span class="p">,</span> <span class="nx">copy</span><span class="p">,</span> <span class="nx">copyIsArray</span><span class="p">,</span> <span class="nx">clone</span><span class="p">,</span>
<span class="nx">target</span> <span class="o">=</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">||</span> <span class="p">{},</span>
<span class="nx">i</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
<span class="nx">length</span> <span class="o">=</span> <span class="nx">arguments</span><span class="p">.</span><span class="nx">length</span><span class="p">,</span>
- <span class="nx">deep</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Handle a deep copy situation</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="k">typeof</span> <span class="nx">target</span> <span class="o">===</span> <span class="s2">&quot;boolean&quot;</span> <span class="p">)</span> <span class="p">{</span>
+ <span class="nx">deep</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-15">&#182;</a> </div> <p>Handle a deep copy situation</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="k">typeof</span> <span class="nx">target</span> <span class="o">===</span> <span class="s2">&quot;boolean&quot;</span> <span class="p">)</span> <span class="p">{</span>
<span class="nx">deep</span> <span class="o">=</span> <span class="nx">target</span><span class="p">;</span>
- <span class="nx">target</span> <span class="o">=</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">||</span> <span class="p">{};</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>skip the boolean and the target</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">i</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>Handle case when target is a string or something (possible in deep copy)</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="k">typeof</span> <span class="nx">target</span> <span class="o">!==</span> <span class="s2">&quot;object&quot;</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">_</span><span class="p">.</span><span class="nx">isFunction</span><span class="p">(</span><span class="nx">target</span><span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
+ <span class="nx">target</span> <span class="o">=</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">||</span> <span class="p">{};</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16">&#182;</a> </div> <p>skip the boolean and the target</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">i</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-17"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-17">&#182;</a> </div> <p>Handle case when target is a string or something (possible in deep copy)</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="k">typeof</span> <span class="nx">target</span> <span class="o">!==</span> <span class="s2">&quot;object&quot;</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">_</span><span class="p">.</span><span class="nx">isFunction</span><span class="p">(</span><span class="nx">target</span><span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
<span class="nx">target</span> <span class="o">=</span> <span class="p">{};</span>
- <span class="p">}</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>extend jQuery itself if only one argument is passed</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">length</span> <span class="o">===</span> <span class="nx">i</span> <span class="p">)</span> <span class="p">{</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-18">&#182;</a> </div> <p>extend jQuery itself if only one argument is passed</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">length</span> <span class="o">===</span> <span class="nx">i</span> <span class="p">)</span> <span class="p">{</span>
<span class="nx">target</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
<span class="o">--</span><span class="nx">i</span><span class="p">;</span>
<span class="p">}</span>
- <span class="k">for</span> <span class="p">(</span> <span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">&#182;</a> </div> <p>Only deal with non-null/undefined values</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="p">(</span><span class="nx">options</span> <span class="o">=</span> <span class="nx">arguments</span><span class="p">[</span> <span class="nx">i</span> <span class="p">])</span> <span class="o">!==</span> <span class="kc">null</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">&#182;</a> </div> <p>Extend the base object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">for</span> <span class="p">(</span> <span class="nx">name</span> <span class="k">in</span> <span class="nx">options</span> <span class="p">)</span> <span class="p">{</span>
+ <span class="k">for</span> <span class="p">(</span> <span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-19">&#182;</a> </div> <p>Only deal with non-null/undefined values</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="p">(</span><span class="nx">options</span> <span class="o">=</span> <span class="nx">arguments</span><span class="p">[</span> <span class="nx">i</span> <span class="p">])</span> <span class="o">!==</span> <span class="kc">null</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-20">&#182;</a> </div> <p>Extend the base object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">for</span> <span class="p">(</span> <span class="nx">name</span> <span class="k">in</span> <span class="nx">options</span> <span class="p">)</span> <span class="p">{</span>
<span class="nx">src</span> <span class="o">=</span> <span class="nx">target</span><span class="p">[</span> <span class="nx">name</span> <span class="p">];</span>
- <span class="nx">copy</span> <span class="o">=</span> <span class="nx">options</span><span class="p">[</span> <span class="nx">name</span> <span class="p">];</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">&#182;</a> </div> <p>Prevent never-ending loop</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">target</span> <span class="o">===</span> <span class="nx">copy</span> <span class="p">)</span> <span class="p">{</span>
+ <span class="nx">copy</span> <span class="o">=</span> <span class="nx">options</span><span class="p">[</span> <span class="nx">name</span> <span class="p">];</span></pre></div> </td> </tr> <tr id="section-21"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-21">&#182;</a> </div> <p>Prevent never-ending loop</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">target</span> <span class="o">===</span> <span class="nx">copy</span> <span class="p">)</span> <span class="p">{</span>
<span class="k">continue</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-15">&#182;</a> </div> <p>Recurse if we're merging plain objects or arrays</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">deep</span> <span class="o">&amp;&amp;</span> <span class="nx">copy</span> <span class="o">&amp;&amp;</span> <span class="p">(</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isPlainObject</span><span class="p">(</span><span class="nx">copy</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">copyIsArray</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">copy</span><span class="p">))</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-22">&#182;</a> </div> <p>Recurse if we're merging plain objects or arrays</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">deep</span> <span class="o">&amp;&amp;</span> <span class="nx">copy</span> <span class="o">&amp;&amp;</span> <span class="p">(</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isPlainObject</span><span class="p">(</span><span class="nx">copy</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="nx">copyIsArray</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">copy</span><span class="p">))</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span> <span class="nx">copyIsArray</span> <span class="p">)</span> <span class="p">{</span>
<span class="nx">copyIsArray</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
<span class="nx">clone</span> <span class="o">=</span> <span class="nx">src</span> <span class="o">&amp;&amp;</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">src</span><span class="p">)</span> <span class="o">?</span> <span class="nx">src</span> <span class="o">:</span> <span class="p">[];</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">clone</span> <span class="o">=</span> <span class="nx">src</span> <span class="o">&amp;&amp;</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isPlainObject</span><span class="p">(</span><span class="nx">src</span><span class="p">)</span> <span class="o">?</span> <span class="nx">src</span> <span class="o">:</span> <span class="p">{};</span>
- <span class="p">}</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16">&#182;</a> </div> <p>Never move original objects, clone them</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">target</span><span class="p">[</span> <span class="nx">name</span> <span class="p">]</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span> <span class="nx">deep</span><span class="p">,</span> <span class="nx">clone</span><span class="p">,</span> <span class="nx">copy</span> <span class="p">);</span></pre></div> </td> </tr> <tr id="section-17"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-17">&#182;</a> </div> <p>Don't bring in undefined values</p> </td> <td class="code"> <div class="highlight"><pre> <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span> <span class="nx">copy</span> <span class="o">!==</span> <span class="kc">undefined</span> <span class="p">)</span> <span class="p">{</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-23"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-23">&#182;</a> </div> <p>Never move original objects, clone them</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">target</span><span class="p">[</span> <span class="nx">name</span> <span class="p">]</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span> <span class="nx">deep</span><span class="p">,</span> <span class="nx">clone</span><span class="p">,</span> <span class="nx">copy</span> <span class="p">);</span></pre></div> </td> </tr> <tr id="section-24"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-24">&#182;</a> </div> <p>Don't bring in undefined values</p> </td> <td class="code"> <div class="highlight"><pre> <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span> <span class="nx">copy</span> <span class="o">!==</span> <span class="kc">undefined</span> <span class="p">)</span> <span class="p">{</span>
<span class="nx">target</span><span class="p">[</span> <span class="nx">name</span> <span class="p">]</span> <span class="o">=</span> <span class="nx">copy</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
- <span class="p">}</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-18">&#182;</a> </div> <p>Return the modified object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">return</span> <span class="nx">target</span><span class="p">;</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-25"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-25">&#182;</a> </div> <p>Return the modified object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">return</span> <span class="nx">target</span><span class="p">;</span>
<span class="p">};</span>
-<span class="nx">_</span><span class="p">.</span><span class="nx">isPlainObject</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span> <span class="nx">obj</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-19">&#182;</a> </div> <p>Must be an Object.
+<span class="nx">_</span><span class="p">.</span><span class="nx">isPlainObject</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span> <span class="nx">obj</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-26"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-26">&#182;</a> </div> <p>Must be an Object.
Because of IE, we also have to check the presence of the constructor property.
Make sure that DOM nodes and window objects don't pass through, as well</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="o">!</span><span class="nx">obj</span> <span class="o">||</span> <span class="o">!</span><span class="nx">_</span><span class="p">.</span><span class="nx">isObject</span><span class="p">(</span><span class="nx">obj</span><span class="p">)</span> <span class="o">||</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">nodeType</span> <span class="o">||</span> <span class="nx">_</span><span class="p">.</span><span class="nx">isWindow</span><span class="p">(</span> <span class="nx">obj</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
<span class="p">}</span>
- <span class="k">try</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-20">&#182;</a> </div> <p>Not own constructor property must be Object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">constructor</span> <span class="o">&amp;&amp;</span>
+ <span class="k">try</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-27"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-27">&#182;</a> </div> <p>Not own constructor property must be Object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">constructor</span> <span class="o">&amp;&amp;</span>
<span class="o">!</span><span class="nx">hasOwn</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">obj</span><span class="p">,</span> <span class="s2">&quot;constructor&quot;</span><span class="p">)</span> <span class="o">&amp;&amp;</span>
<span class="o">!</span><span class="nx">hasOwn</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">obj</span><span class="p">.</span><span class="nx">constructor</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="s2">&quot;isPrototypeOf&quot;</span><span class="p">)</span> <span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
<span class="p">}</span>
- <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span> <span class="nx">e</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-21"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-21">&#182;</a> </div> <p>IE8,9 Will throw exceptions on certain host objects #9897</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-22">&#182;</a> </div> <p>Own properties are enumerated firstly, so to speed up,
+ <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span> <span class="nx">e</span> <span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-28"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-28">&#182;</a> </div> <p>IE8,9 Will throw exceptions on certain host objects #9897</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-29"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-29">&#182;</a> </div> <p>Own properties are enumerated firstly, so to speed up,
if last one is own, then all properties are own.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">key</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span> <span class="nx">key</span> <span class="k">in</span> <span class="nx">obj</span> <span class="p">)</span> <span class="p">{}</span>
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "superscore",
"homepage": "https://github.com/DavidSouther/superscore",
- "version": "0.2.4.1",
+ "version": "0.2.5",
"author": {
"name": "David Souther",
"email": "<davidsouther@gmail.com>"
View
2  src/core.js
@@ -1,4 +1,4 @@
-// superscore core.js 0.2.4
+// superscore core.js 0.2.5
// (c) 2012 David Souther
// superscore is freely distributable under the MIT license.
// For all details and documentation:
Please sign in to comment.
Something went wrong with that request. Please try again.