diff --git a/doc/README.md b/doc/README.md
index a5da274a9..f564d5c31 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -109,6 +109,7 @@
* [`_.templateSettings.escape`](#_templatesettingsescape)
* [`_.templateSettings.evaluate`](#_templatesettingsevaluate)
* [`_.templateSettings.interpolate`](#_templatesettingsinterpolate)
+* [`_.templateSettings.variable`](#_templatesettingsvariable)
@@ -150,7 +151,7 @@ The `lodash` function.
### `_.VERSION`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3015 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3013 "View in source") [Ⓣ][1]
*(String)*: The semantic version number.
@@ -281,7 +282,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
### `_.chain(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2965 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2963 "View in source") [Ⓣ][1]
Wraps the value in a `lodash` chainable object.
@@ -2356,7 +2357,7 @@ jQuery(window).on('scroll', throttled);
### `_.times(n, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2912 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2910 "View in source") [Ⓣ][1]
Executes the `callback` function `n` times. The `callback` is invoked with `1` argument; *(index)*.
@@ -2464,7 +2465,7 @@ _.uniq([1, 2, 1, 3, 1, 4]);
### `_.uniqueId([prefix])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2935 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2933 "View in source") [Ⓣ][1]
Generates a unique id. If `prefix` is passed, the id will be appended to it.
@@ -2613,7 +2614,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
### `_.prototype.chain()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2983 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2981 "View in source") [Ⓣ][1]
Extracts the value from a wrapped chainable object.
@@ -2637,7 +2638,7 @@ _([1, 2, 3]).value();
### `_.prototype.value()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3000 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2998 "View in source") [Ⓣ][1]
Extracts the value from a wrapped chainable object.
@@ -2668,7 +2669,7 @@ _([1, 2, 3]).value();
### `_.templateSettings`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3025 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3023 "View in source") [Ⓣ][1]
*(Object)*: By default, Lo-Dash uses ERB-style template delimiters, change the following template settings to use alternative delimiters.
@@ -2683,7 +2684,7 @@ _([1, 2, 3]).value();
### `_.templateSettings.escape`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3034 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3032 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
@@ -2698,7 +2699,7 @@ _([1, 2, 3]).value();
### `_.templateSettings.evaluate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3043 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3041 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect code to be evaluated.
@@ -2713,7 +2714,7 @@ _([1, 2, 3]).value();
### `_.templateSettings.interpolate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3052 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3050 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to inject.
@@ -2722,6 +2723,21 @@ _([1, 2, 3]).value();
+
+
+
+
+
+### `_.templateSettings.variable`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3059 "View in source") [Ⓣ][1]
+
+*(String)*: Used to reference the data object in the template text.
+
+* * *
+
+
+
+
diff --git a/lodash.js b/lodash.js
index 4c4c9a7b5..bef20a43b 100644
--- a/lodash.js
+++ b/lodash.js
@@ -391,11 +391,11 @@
}
// set additional template data values
var args = data.args,
- arrayBranch = data.arrayBranch,
objectBranch = data.objectBranch,
firstArg = /^[^,]+/.exec(args)[0],
+ loopExp = objectBranch.loopExp,
iterate = data.iterate,
- iteratedObject = /\S+$/.exec(objectBranch.loopExp || firstArg)[0];
+ iteratedObject = /\S+$/.exec(loopExp || firstArg)[0];
data.firstArg = firstArg;
data.hasDontEnumBug = hasDontEnumBug;
@@ -413,7 +413,7 @@
if (firstArg == 'array' || iterate == 'arrays') {
data.objectBranch = null;
}
- else if (!objectBranch.loopExp) {
+ else if (!loopExp) {
objectBranch.loopExp = 'index in ' + iteratedObject;
}
// create the function factory
@@ -1273,7 +1273,7 @@
if (!callback) {
// fast path for arrays of numbers
- if (array[0] === +array[0] && length < argsLimit) {
+ if (array[0] === +array[0] && length <= argsLimit) {
// some JavaScript engines have a limit on the number of arguments functions
// can accept before clipping the argument length or throwing an error
// https://bugs.webkit.org/show_bug.cgi?id=80797
@@ -1323,7 +1323,7 @@
result = computed;
if (!callback) {
- if (array[0] === +array[0] && length < argsLimit) {
+ if (array[0] === +array[0] && length <= argsLimit) {
try {
return Math.min.apply(Math, array);
} catch(e) { }
@@ -2850,9 +2850,6 @@
if (interpolateDelimiter == null) {
interpolateDelimiter = defaults.interpolate;
}
- if (variable == null) {
- variable = defaults.variable;
- }
// tokenize delimiters to avoid escaping them
if (escapeDelimiter) {
@@ -2874,10 +2871,11 @@
// if `options.variable` is not specified, add `data` to the top of the scope chain
if (!variable) {
- text = 'with (object || {}) {\n' + text + '\n}\n';
+ variable = defaults.variable;
+ text = 'with (' + variable + ' || {}) {\n' + text + '\n}\n';
}
- text = 'function(' + (variable || 'object') + ') {\n' +
+ text = 'function(' + variable + ') {\n' +
'var __p, __t;\n' +
'function print() { __p += __j.call(arguments, "") }\n' +
text +
@@ -3049,7 +3047,16 @@
* @memberOf _.templateSettings
* @type RegExp
*/
- 'interpolate': reInterpolateDelimiter
+ 'interpolate': reInterpolateDelimiter,
+
+ /**
+ * Used to reference the data object in the template text.
+ *
+ * @static
+ * @memberOf _.templateSettings
+ * @type String
+ */
+ 'variable': 'object'
},
// assign static methods
diff --git a/lodash.min.js b/lodash.min.js
index 5c6028542..e7fd242de 100644
--- a/lodash.min.js
+++ b/lodash.min.js
@@ -2,26 +2,25 @@
Lo-Dash 0.1.0 lodash.com/license
Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE
*/
-;(function(t,l){"use strict";var n=!0,o=null,q=!1;function S(a){return"[object Arguments]"==h.call(a)}function m(a){return new p(a)}function p(a){if(a&&a._wrapped)return a;this._wrapped=a}function j(){for(var a,b,c,d=-1,e=arguments.length,f={e:"",f:"",k:"",r:"",c:{n:"++oarguments.length;d&&(b=u(b,d));if(e===+e){for(e&&f&&(c=a[--e]);e--;)c=b(c,a[e],e,a);return c}var g=U(a);for((e=g.length)&&f&&(c=a[g[--e]]);e--;)f=g[e],c=b(c,a[f],f,a);return c}function V(a,b,c){return b==l||c?a[0]:k.call(a,0,b)}function fa(a,b){if(b)return E.apply(x,a);for(var c,d=-1,e=a.length,f=[];++dv(f,b)&&W(e,function(a){return-1d&&(d=c,g=a[e]);return g}function ja(a,b,c){return k.call(a,b==l||c?1:b)}function ga(a,
+;(function(t,l){"use strict";var n=!0,o=null,q=!1;function S(a){return"[object Arguments]"==h.call(a)}function m(a){return new p(a)}function p(a){if(a&&a._wrapped)return a;this._wrapped=a}function j(){for(var a,b,c,d=-1,e=arguments.length,f={e:"",f:"",k:"",r:"",c:{n:"++oarguments.length;d&&(b=u(b,d));if(e===+e){for(e&&f&&(c=a[--e]);e--;)c=b(c,a[e],e,a);return c}var g=U(a);for((e=g.length)&&f&&(c=a[g[--e]]);e--;)f=g[e],c=b(c,a[f],f,a);return c}function V(a,b,c){return b==l||c?a[0]:k.call(a,0,b)}function fa(a,b){if(b)return E.apply(x,a);for(var c,d=-1,e=a.length,f=[];++dv(f,b)&&W(e,function(a){return-1d&&(d=c,g=a[e]);return g}function ja(a,b,c){return k.call(a,b==l||c?1:b)}function ga(a,
b,c){var d,e=0,f=a.length;for(c&&(b=c(b));e>1,(c?c(a[d]):a[d])f&&(b=n);++ev(i,d))i.push(d),g.push(a[e]);return g}function u(a,b){var c,d=h.call(a)==r;if(d){if(B)return a=B.call.apply(B,arguments),function(){return arguments.length?a.apply(l,arguments):a()}}else c=b,b=a;var e=k.call(arguments,2),f=e.length;return function(){var g;g=arguments;d||(a=b[c]);f&&(g.length&&
(e.length=f,F.apply(e,g)),g=e);g=g.length?a.apply(b,g):a.call(b);e.length=f;return g}}function M(a,b,c){c||(c=[]);if(a===b)return 0!==a||1/a==1/b;if(a==l||b==l)return a===b;a.t&&(a=a._wrapped);b.t&&(b=b._wrapped);if(a.isEqual&&h.call(a.isEqual)==r)return a.isEqual(b);if(b.isEqual&&h.call(b.isEqual)==r)return b.isEqual(a);var d=h.call(a);if(d!=h.call(b))return q;switch(d){case K:return a==""+b;case N:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case la:case ma:return+a==+b;case na:return a.source==b.source&&
a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return q;for(var e=c.length;e--;)if(c[e]==a)return n;var e=-1,f=n,g=0;c.push(a);if(d==I){if(g=a.length,f=g==b.length)for(;g--&&(f=M(a[g],b[g],c)););}else{if("constructor"in a!="constructor"in b||a.constructor!=b.constructor)return q;for(var i in a)if(s.call(a,i)&&(g++,!(f=s.call(b,i)&&M(a[i],b[i],c))))break;if(f){for(i in b)if(s.call(b,i)&&!g--)break;f=!g}if(f&&aa)for(;7>++e&&!(i=ba[e],
s.call(a,i)&&!(f=s.call(b,i)&&M(a[i],b[i],c))););}c.pop();return f}function oa(a){return(a+"").replace(/&/g,"&").replace(//g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},after:function(a,b){return 1>a?b():function(){if(1>--a)return b.apply(this,
+"")}),ta=j(y,{a:"h",j:{b:"z[o]=h[o]",o:"z.push(h[o])"}}),y=j(A,{j:"if(v[o]==J)"+A.j}),R=j(A),O=j({a:"v",k:"[]",s:q,j:"if(H.call(v[o])==l)z.push(o)",e:"z.sort()"});S(arguments)||(S=function(a){return!(!a||!s.call(a,"callee"))});var U=Y||j({a:"v",f:"if(v!==Object(v))throw TypeError()",k:"[]",j:"z.push(o)"});R(m,{VERSION:"0.1.0",templateSettings:{escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"object"},after:function(a,b){return 1>a?b():function(){if(1>--a)return b.apply(this,
arguments)}},bind:u,bindAll:function(a){var b=arguments,c=1;1==b.length&&(c=0,b=O(a));for(var d=b.length;cv(e,a[b])&&d.push(a[b]);return d},escape:oa,every:W,extend:R,filter:ra,find:sa,first:V,flatten:fa,
forEach:G,functions:O,groupBy:Ia,has:function(a,b){return s.call(a,b)},identity:ca,indexOf:v,initial:function(a,b,c){return k.call(a,0,-(b==l||c?1:b))},intersection:ha,invoke:function(a,b){for(var c=k.call(arguments,2),d=-1,e=a.length,f=h.call(b)==r,g=[];++darguments.length&&(b=a||0,a=0);for(var d=-1,e=Math.max(Math.ceil((b-a)/c),0),f=Array(e);++dd?1:0}),"b")},sortedIndex:ga,tap:function(a,b){b(a);return a},template:qa,throttle:function(a,b){function c(){i=new Date;g=l;a.apply(f,d)}var d,e,f,g,i=0;return function(){var h=new Date,j=b-(h-i);d=arguments;f=this;0>=j?(i=h,e=a.apply(f,d)):g||(g=P(c,j));return e}},times:function(a,b,c){c&&(b=u(b,c));for(c=0;c