diff --git a/build.js b/build.js
index 0ef6d0a7e..55a77c385 100755
--- a/build.js
+++ b/build.js
@@ -1753,6 +1753,14 @@
' }'
].join('\n'));
+ // replace `_.result`
+ source = replaceFunction(source, 'result', [
+ ' function result(object, property) {',
+ ' var value = object ? object[property] : null;',
+ ' return isFunction(value) ? object[property]() : value;',
+ ' }'
+ ].join('\n'));
+
// replace `_.template`
source = replaceFunction(source, 'template', [
' function template(text, data, options) {',
diff --git a/doc/README.md b/doc/README.md
index f15c733b0..32da63241 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -756,7 +756,7 @@ The wrapper functions `first` and `last` return wrapped values when `n` is passe
### `_.tap(value, interceptor)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4481 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4479 "View in source") [Ⓣ][1]
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
@@ -786,7 +786,7 @@ _([1, 2, 3, 4])
### `_.prototype.toString()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4498 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4496 "View in source") [Ⓣ][1]
Produces the `toString` result of the wrapped value.
@@ -807,7 +807,7 @@ _([1, 2, 3]).toString();
### `_.prototype.valueOf()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4515 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4513 "View in source") [Ⓣ][1]
Extracts the wrapped value.
@@ -3056,7 +3056,7 @@ _.result(object, 'stuff');
### `_.template(text, data, options)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4281 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4279 "View in source") [Ⓣ][1]
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code.
@@ -3134,7 +3134,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
### `_.times(n, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4407 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4405 "View in source") [Ⓣ][1]
Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*.
@@ -3166,7 +3166,7 @@ _.times(3, function(n) { this.cast(n); }, mage);
### `_.unescape(string)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4433 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4431 "View in source") [Ⓣ][1]
The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
@@ -3190,7 +3190,7 @@ _.unescape('Moe, Larry & Curly');
### `_.uniqueId([prefix])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4453 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4451 "View in source") [Ⓣ][1]
Generates a unique ID. If `prefix` is passed, the ID will be appended to it.
@@ -3243,7 +3243,7 @@ A reference to the `lodash` function.
### `_.VERSION`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4683 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4681 "View in source") [Ⓣ][1]
*(String)*: The semantic version number.
diff --git a/lodash.js b/lodash.js
index c1aca66f0..e78cde50a 100644
--- a/lodash.js
+++ b/lodash.js
@@ -4194,8 +4194,6 @@
* // => 'nonsense'
*/
function result(object, property) {
- // based on Backbone's private `getValue` function
- // https://github.com/documentcloud/backbone/blob/0.9.2/backbone.js#L1419-1424
var value = object ? object[property] : undefined;
return isFunction(value) ? object[property]() : value;
}
diff --git a/lodash.underscore.js b/lodash.underscore.js
index 4a6fd2200..3897afaf6 100644
--- a/lodash.underscore.js
+++ b/lodash.underscore.js
@@ -3535,9 +3535,7 @@
* // => 'nonsense'
*/
function result(object, property) {
- // based on Backbone's private `getValue` function
- // https://github.com/documentcloud/backbone/blob/0.9.2/backbone.js#L1419-1424
- var value = object ? object[property] : undefined;
+ var value = object ? object[property] : null;
return isFunction(value) ? object[property]() : value;
}
diff --git a/lodash.underscore.min.js b/lodash.underscore.min.js
index 08d062ee4..c0c4fc243 100644
--- a/lodash.underscore.min.js
+++ b/lodash.underscore.min.js
@@ -26,8 +26,8 @@ var e=-1;t=yt(0,ot((t-n)/r));for(var u=Array(t);++eI(arguments,u,1)&&e.push(u)}return e},u.wrap=function(n,t){return function(){var r=[n];return ct.apply(r,arguments),t.apply(this,r)}},u.zip=function(n){for(var t=-1,r=n?R(T(arguments,"length")):0,e=Array(r);++tr?yt(0,e+r):_t(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=W,u.noConflict=function(){return n._=Z,this},u.random=function(n,t){return n==H&&t==H&&(t=1),n=+n||0,t==H&&(t=n,n=0),n+at(mt()*((+t||0)-n+1))},u.reduce=q,u.reduceRight=B,u.result=function(n,r){var e=n?n[r]:t;
-return b(e)?n[r]():e},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:qt(n).length},u.some=D,u.sortedIndex=C,u.template=function(n,t,r){n||(n=""),r=y({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||rt).source+"|"+(r.interpolate||rt).source+"|"+(r.evaluate||rt).source+"|$","g"),function(t,r,u,i,a){return o+=n.slice(e,a).replace(ut,f),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+t.length,t
+},u.isNull=function(n){return n===H},u.isNumber=w,u.isObject=j,u.isRegExp=function(n){return n instanceof RegExp||lt.call(n)==Et},u.isString=x,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?yt(0,e+r):_t(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=W,u.noConflict=function(){return n._=Z,this},u.random=function(n,t){return n==H&&t==H&&(t=1),n=+n||0,t==H&&(t=n,n=0),n+at(mt()*((+t||0)-n+1))},u.reduce=q,u.reduceRight=B,u.result=function(n,t){var r=n?n[t]:H;
+return b(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:qt(n).length},u.some=D,u.sortedIndex=C,u.template=function(n,t,r){n||(n=""),r=y({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||rt).source+"|"+(r.interpolate||rt).source+"|"+(r.evaluate||rt).source+"|$","g"),function(t,r,u,i,a){return o+=n.slice(e,a).replace(ut,f),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+t.length,t
}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var a=Function("_","return "+o)(u)}catch(c){throw c.source=o,c}return t?a(t):(a.source=o,a)},u.unescape=function(n){return n==H?"":(n+"").replace(nt,s)},u.uniqueId=function(n){var t=++X+"";return n?n+t:t},u.all=O,u.any=D,u.detect=k,u.foldl=q,u.foldr=B,u.include=E,u.inject=q,u.first=M,u.last=function(n,t,r){if(n){var e=0,u=n.length;
if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==H||r)return n[u-1];return p(n,yt(0,u-e))}},u.take=M,u.head=M,u.chain=function(n){return n=new u(n),n.__chain__=G,n},u.VERSION="1.0.0-rc.3",W(u),u.prototype.chain=function(){return this.__chain__=G,this},u.prototype.value=function(){return this.__wrapped__},e("pop push reverse shift sort splice unshift".split(" "),function(n){var t=Q[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),kt&&0===n.length&&delete n[0],this
}}),e(["concat","join","slice"],function(n){var t=Q[n];u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new u(n),n.__chain__=G),n}}),K?typeof module=="object"&&module&&module.exports==K?(module.exports=u)._=u:K._=u:n._=u})(this);
\ No newline at end of file
diff --git a/test/test-build.js b/test/test-build.js
index 8e316def8..6207a8289 100644
--- a/test/test-build.js
+++ b/test/test-build.js
@@ -798,6 +798,7 @@
actual = lodash.pick(object, function(value) { return value != 3; });
deepEqual(_.keys(actual), [], '_.pick should not accept a `callback`: ' + basename);
+ strictEqual(lodash.result(), null, '_.result should return `null` when passed a falsey `object` argument: ' + basename);
strictEqual(lodash.some([false, true, false]), true, '_.some: ' + basename);
equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename);
equal('imports' in lodash.templateSettings, false, '_.templateSettings should not have an "imports" property: ' + basename);