diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index e0828ed4e..b1496e2b7 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -2419,7 +2419,8 @@ * // => false */ function isBoolean(value) { - return value === true || value === false || toString.call(value) == boolClass; + return value === true || value === false || + value && typeof value == 'object' && toString.call(value) == boolClass || false; } /** @@ -2436,7 +2437,7 @@ * // => true */ function isDate(value) { - return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false; + return value && typeof value == 'object' && toString.call(value) == dateClass || false; } /** @@ -2453,7 +2454,7 @@ * // => true */ function isElement(value) { - return value ? value.nodeType === 1 : false; + return value && value.nodeType === 1 || false; } /** @@ -2688,7 +2689,8 @@ * // => true */ function isNumber(value) { - return typeof value == 'number' || toString.call(value) == numberClass; + return typeof value == 'number' || + value && typeof value == 'object' && toString.call(value) == numberClass || false; } /** @@ -2741,7 +2743,7 @@ * // => true */ function isRegExp(value) { - return (value && objectTypes[typeof value]) ? toString.call(value) == regexpClass : false; + return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false; } /** @@ -2758,7 +2760,8 @@ * // => true */ function isString(value) { - return typeof value == 'string' || toString.call(value) == stringClass; + return typeof value == 'string' || + value && typeof value == 'object' && toString.call(value) == stringClass || false; } /** @@ -5896,12 +5899,11 @@ * @returns {Function} Returns the new function. * @example * - * var hello = function(name) { return 'hello ' + name; }; - * hello = _.wrap(hello, function(func) { - * return 'before, ' + func('fred') + ', after'; + * var pre= _.wrap(_.escape, function(func, text) { + * return '
' + func(text) + '
'; * }); - * hello(); - * // => 'before, hello fred, after' + * pre('Fred, Wilma, & Pebbles'); + * // => '
Fred, Wilma, & Pebbles
' */ function wrap(value, wrapper) { if (!isFunction(wrapper)) { @@ -5945,7 +5947,7 @@ * @example * * var object = { 'name': 'fred' }; - * object === _.identity(object); + * _.identity(object) === object; * // => true */ function identity(value) { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index c2b891cf4..545d1e4ed 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -17,9 +17,9 @@ if(!a||i||l||p||!(We.fastBind||Se&&c))v=function(){var g=arguments,h=a?u:this;re var r="var n,t="+e.d+",E="+e.e+";if(!t)return E;"+e.i+";";e.b?(r+="var u=t.length;n=-1;if("+e.b+"){",We.unindexedChars&&(r+="if(s(t)){t=t.split('')}"),r+="while(++nk;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}";r+="}"}return(e.b||We.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(Z,K,le,de,_,yt,Je,xt,X.f,fe,Y,Ke,H,ce,ke) }function pt(n){return wt(n)?Ie(n):{}}function st(n){return Xe[n]}function gt(){var t=(t=y.indexOf)===Tt?n:t;return t}function ht(n){var t,e;return!n||ke.call(n)!=J||(t=n.constructor,bt(t)&&!(t instanceof t))||!We.argsClass&&yt(n)||!We.nodeClass&&f(n)?!1:We.ownLast?(ur(n,function(n,t,r){return e=de.call(r,t),!1}),false!==e):(ur(n,function(n,t){e=t}),typeof e=="undefined"||de.call(n,e))}function vt(n){return Ye[n]}function yt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==L||!1 -}function mt(n,t,e){var r=He(n),u=r.length;for(t=Z(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function dt(n){var t=[];return ur(n,function(n,e){bt(n)&&t.push(e)}),t.sort()}function _t(n){for(var t=-1,e=He(n),r=e.length,u={};++te?Pe(0,o+e):e)||0,Je(n)?a=-1e?Pe(0,o+e):e)||0,Je(n)?a=-1o&&(o=i)}}else t=!t&&xt(n)?r:y.createCallback(t,e,3),tr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o }function Nt(n,t,e,r){var u=3>arguments.length;if(t=Z(t,r,4),Je(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Z(t,r,4),At(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Rt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return It(n,function(n){var e=at(0,++t);r[t]=r[e],r[e]=n}),r}function Ft(n,t,e){var r;if(t=y.createCallback(t,e,3),Je(n)){e=-1;for(var u=n.length;++e=w&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++ru(i,c)&&l.push(c);return f&&s(i),l}function Lt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,e,3);++or?Pe(0,u+r):r||0}else if(r)return r=qt(t,e),t[r]===e?r:-1; @@ -44,8 +44,8 @@ for(var u=Xt(t);++re?Pe(0,r+e):Re(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},y.mixin=Vt,y.noConflict=function(){return e._=pe,this},y.parseInt=pr,y.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=!0)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=$e(),Re(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):at(n,t) },y.reduce=Nt,y.reduceRight=Pt,y.result=function(n,t){if(n){var e=n[t];return bt(e)?n[t]():e}},y.runInContext=h,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:He(n).length},y.some=Ft,y.sortedIndex=qt,y.template=function(n,t,e){var r=y.templateSettings;n=oe(n||""),e=rr({},e,r);var u,o=rr({},e.imports,r.imports),r=He(o),o=Ct(o),i=0,l=e.interpolate||N,f="__p+='",l=ue((e.escape||N).source+"|"+l.source+"|"+(l===B?S:N).source+"|"+(e.evaluate||N).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(R,a),e&&(f+="'+__e("+e+")+'"),l&&(u=!0,f+="';"+l+";\n__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t }),f+="';",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(C,""):f).replace(E,"$1").replace(O,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=ne(r,"return "+f).apply(v,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.unescape=function(n){return null==n?"":oe(n).replace(Ze,vt)},y.uniqueId=function(n){var t=++d;return oe(null==n?"":n)+t diff --git a/dist/lodash.js b/dist/lodash.js index 98e712937..be1e5a277 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -2086,7 +2086,8 @@ * // => false */ function isBoolean(value) { - return value === true || value === false || toString.call(value) == boolClass; + return value === true || value === false || + value && typeof value == 'object' && toString.call(value) == boolClass || false; } /** @@ -2103,7 +2104,7 @@ * // => true */ function isDate(value) { - return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false; + return value && typeof value == 'object' && toString.call(value) == dateClass || false; } /** @@ -2120,7 +2121,7 @@ * // => true */ function isElement(value) { - return value ? value.nodeType === 1 : false; + return value && value.nodeType === 1 || false; } /** @@ -2348,7 +2349,8 @@ * // => true */ function isNumber(value) { - return typeof value == 'number' || toString.call(value) == numberClass; + return typeof value == 'number' || + value && typeof value == 'object' && toString.call(value) == numberClass || false; } /** @@ -2401,7 +2403,7 @@ * // => true */ function isRegExp(value) { - return value ? (typeof value == 'object' && toString.call(value) == regexpClass) : false; + return value && typeof value == 'object' && toString.call(value) == regexpClass || false; } /** @@ -2418,7 +2420,8 @@ * // => true */ function isString(value) { - return typeof value == 'string' || toString.call(value) == stringClass; + return typeof value == 'string' || + value && typeof value == 'object' && toString.call(value) == stringClass || false; } /** @@ -5557,12 +5560,11 @@ * @returns {Function} Returns the new function. * @example * - * var hello = function(name) { return 'hello ' + name; }; - * hello = _.wrap(hello, function(func) { - * return 'before, ' + func('fred') + ', after'; + * var pre= _.wrap(_.escape, function(func, text) { + * return '
' + func(text) + '
'; * }); - * hello(); - * // => 'before, hello fred, after' + * pre('Fred, Wilma, & Pebbles'); + * // => '
Fred, Wilma, & Pebbles
' */ function wrap(value, wrapper) { if (!isFunction(wrapper)) { @@ -5606,7 +5608,7 @@ * @example * * var object = { 'name': 'fred' }; - * object === _.identity(object); + * _.identity(object) === object; * // => true */ function identity(value) { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 8f46ae211..d5ebd6d9c 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -17,7 +17,7 @@ break}if(!a){var c;e&&(f=e(l,t),c=typeof f!="undefined")&&(l=f),c||(l=i?Pe(l)?l: }return h?(c(v.k),p(v)):u&&c(v),s}function ft(n){return function(t,e,r){var u={};e=Y.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++re?Re(0,o+e):e)||0,Pe(n)?a=-1e?Re(0,o+e):e)||0,Pe(n)?a=-1o&&(o=i)}}else t=!t&&jt(n)?r:Y.createCallback(t,e,3),Nt(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function At(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Xt(r);++earguments.length;t=et(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++oe?Re(0,r+e):Ae(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Y.mixin=Jt,Y.noConflict=function(){return e._=le,this},Y.parseInt=Qe,Y.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=!0)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Be(),Ae(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):at(n,t) },Y.reduce=Dt,Y.reduceRight=Bt,Y.result=function(n,t){if(n){var e=n[t];return bt(e)?n[t]():e}},Y.runInContext=h,Y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ke(n).length},Y.some=Ft,Y.sortedIndex=Pt,Y.template=function(n,t,e){var r=Y.templateSettings;n=oe(n||""),e=G({},e,r);var u,o=G({},e.imports,r.imports),r=Ke(o),o=kt(o),i=0,f=e.interpolate||S,l="__p+='",f=ue((e.escape||S).source+"|"+f.source+"|"+(f===N?C:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(A,a),e&&(l+="'+__e("+e+")+'"),f&&(u=!0,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t }),l+="';",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(k,"$1").replace(x,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=ne(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Y.unescape=function(n){return null==n?"":oe(n).replace(Ue,vt)},Y.uniqueId=function(n){var t=++m;return oe(null==n?"":n)+t diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index f4ca0c3e8..1c0242f3a 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -1187,7 +1187,8 @@ * // => false */ function isBoolean(value) { - return value === true || value === false || toString.call(value) == boolClass; + return value === true || value === false || + value && typeof value == 'object' && toString.call(value) == boolClass || false; } /** @@ -1204,7 +1205,7 @@ * // => true */ function isDate(value) { - return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false; + return value && typeof value == 'object' && toString.call(value) == dateClass || false; } /** @@ -1221,7 +1222,7 @@ * // => true */ function isElement(value) { - return value ? value.nodeType === 1 : false; + return value && value.nodeType === 1 || false; } /** @@ -1452,7 +1453,8 @@ * // => true */ function isNumber(value) { - return typeof value == 'number' || toString.call(value) == numberClass; + return typeof value == 'number' || + value && typeof value == 'object' && toString.call(value) == numberClass || false; } /** @@ -1469,7 +1471,7 @@ * // => true */ function isRegExp(value) { - return (value && objectTypes[typeof value]) ? toString.call(value) == regexpClass : false; + return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false; } /** @@ -1486,7 +1488,8 @@ * // => true */ function isString(value) { - return typeof value == 'string' || toString.call(value) == stringClass; + return typeof value == 'string' || + value && typeof value == 'object' && toString.call(value) == stringClass || false; } /** @@ -4063,12 +4066,11 @@ * @returns {Function} Returns the new function. * @example * - * var hello = function(name) { return 'hello ' + name; }; - * hello = _.wrap(hello, function(func) { - * return 'before, ' + func('fred') + ', after'; + * var pre= _.wrap(_.escape, function(func, text) { + * return '
' + func(text) + '
'; * }); - * hello(); - * // => 'before, hello fred, after' + * pre('Fred, Wilma, & Pebbles'); + * // => '
Fred, Wilma, & Pebbles
' */ function wrap(value, wrapper) { if (!isFunction(wrapper)) { @@ -4112,7 +4114,7 @@ * @example * * var object = { 'name': 'fred' }; - * object === _.identity(object); + * _.identity(object) === object; * // => true */ function identity(value) { diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index e99c5d5db..fb52a3db9 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -9,13 +9,13 @@ if(null==n||null==r)return n===r;var o=Sr.call(n),i=Sr.call(r);if(o!=i)return!1; var l=!0,c=0;if(t.push(n),e.push(r),i){if(c=r.length,l=c==n.length)for(;c--&&(l=a(n[c],r[c],t,e)););return l}return Qr(r,function(r,u,o){return Tr.call(o,u)?(c++,!(l=Tr.call(n,u)&&a(n[u],r,t,e))&&nr):void 0}),l&&Qr(n,function(n,r,t){return Tr.call(t,r)?!(l=-1<--c)&&nr:void 0}),l}function l(n,r,t){for(var e=-1,u=g(),o=n?n.length:0,i=[],f=t?[]:i;++eu(f,l))&&(t&&f.push(l),i.push(a))}return i}function c(n){return function(r,t,e){var u={};t=K(t,e,3),e=-1; var o=r?r.length:0;if(typeof o=="number")for(;++ee&&(e=t,u=n)});else for(;++ou&&(u=t);return u}function D(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=i(r,e,4);var o=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++o]);++oarguments.length;return r=i(r,e,4),k(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function I(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return R(n,function(n){var t;t=++r,t=0+Er(Ir()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function W(n,r,t){var e; -r=K(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function P(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=K(r,t,3);++oe?Mr(0,u+e):e||0}else if(e)return e=G(r,t),r[e]===t?e:-1;return n(r,t,e)}function V(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=K(r,t,3);++u>>1,t(n[e])e&&(e=t,u=n)});else for(;++ou&&(u=t);return u +}function D(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=i(r,e,4);var o=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++o]);++oarguments.length;return r=i(r,e,4),k(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function I(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0); +return R(n,function(n){var t;t=++r,t=0+Er(Ir()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function W(n,r,t){var e;r=K(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function P(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=K(r,t,3);++oe?Mr(0,u+e):e||0}else if(e)return e=G(r,t),r[e]===t?e:-1;return n(r,t,e)}function V(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=K(r,t,3);++u>>1,t(n[e])r?0:r);++nt?Mr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return gr._=wr,this},u.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Er(Ir()*(r-n+1))},u.reduce=M,u.reduceRight=$,u.result=function(n,r){if(n){var t=n[r]; +},u.every=S,u.find=N,u.has=function(n,r){return n?Tr.call(n,r):!1},u.identity=Q,u.indexOf=U,u.isArguments=y,u.isArray=Ur,u.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Sr.call(n)==ir||!1},u.isDate=function(n){return n&&typeof n=="object"&&Sr.call(n)==fr||!1},u.isElement=function(n){return n&&1===n.nodeType||!1},u.isEmpty=w,u.isEqual=function(n,r){return a(n,r)},u.isFinite=function(n){return Fr(n)&&!qr(parseFloat(n))},u.isFunction=j,u.isNaN=function(n){return E(n)&&n!=+n},u.isNull=function(n){return null===n +},u.isNumber=E,u.isObject=x,u.isRegExp=function(n){return n&&sr[typeof n]&&Sr.call(n)==cr||!1},u.isString=T,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Mr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return gr._=wr,this},u.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Er(Ir()*(r-n+1))},u.reduce=M,u.reduceRight=$,u.result=function(n,r){if(n){var t=n[r]; return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Gr(n).length},u.some=W,u.sortedIndex=G,u.template=function(n,r,e){var o=u,i=o.templateSettings;n=(n||"")+"",e=_({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||tr).source+"|"+(e.interpolate||tr).source+"|"+(e.evaluate||tr).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(er,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r }),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Kr,v)},u.uniqueId=function(n){var r=++Z+"";return n?n+r:r},u.all=S,u.any=W,u.detect=N,u.findWhere=function(n,r){return z(n,r,!0)},u.foldl=M,u.foldr=$,u.include=O,u.inject=M,u.first=P,u.last=function(n,r,t){var e=0,u=n?n.length:0; if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:Y;return Wr.call(n,Mr(0,u-e))},u.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=A(n)),null==r||t?n?n[0+Er(Ir()*(n.length-1-0+1))]:Y:(n=I(n),n.length=$r(Mr(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.2.1",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},R("pop push reverse shift sort splice unshift".split(" "),function(n){var r=dr[n]; diff --git a/lodash.js b/lodash.js index ed81d565a..3702cd811 100644 --- a/lodash.js +++ b/lodash.js @@ -2436,7 +2436,8 @@ * // => false */ function isBoolean(value) { - return value === true || value === false || toString.call(value) == boolClass; + return value === true || value === false || + value && typeof value == 'object' && toString.call(value) == boolClass || false; } /** @@ -2453,7 +2454,7 @@ * // => true */ function isDate(value) { - return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false; + return value && typeof value == 'object' && toString.call(value) == dateClass || false; } /** @@ -2470,7 +2471,7 @@ * // => true */ function isElement(value) { - return value ? value.nodeType === 1 : false; + return value && value.nodeType === 1 || false; } /** @@ -2705,7 +2706,8 @@ * // => true */ function isNumber(value) { - return typeof value == 'number' || toString.call(value) == numberClass; + return typeof value == 'number' || + value && typeof value == 'object' && toString.call(value) == numberClass || false; } /** @@ -2758,7 +2760,7 @@ * // => true */ function isRegExp(value) { - return (value && objectTypes[typeof value]) ? toString.call(value) == regexpClass : false; + return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false; } /** @@ -2775,7 +2777,8 @@ * // => true */ function isString(value) { - return typeof value == 'string' || toString.call(value) == stringClass; + return typeof value == 'string' || + value && typeof value == 'object' && toString.call(value) == stringClass || false; } /** @@ -5913,12 +5916,11 @@ * @returns {Function} Returns the new function. * @example * - * var hello = function(name) { return 'hello ' + name; }; - * hello = _.wrap(hello, function(func) { - * return 'before, ' + func('fred') + ', after'; + * var pre= _.wrap(_.escape, function(func, text) { + * return '
' + func(text) + '
'; * }); - * hello(); - * // => 'before, hello fred, after' + * pre('Fred, Wilma, & Pebbles'); + * // => '
Fred, Wilma, & Pebbles
' */ function wrap(value, wrapper) { if (!isFunction(wrapper)) { @@ -5962,7 +5964,7 @@ * @example * * var object = { 'name': 'fred' }; - * object === _.identity(object); + * _.identity(object) === object; * // => true */ function identity(value) {