diff --git a/doc/README.md b/doc/README.md index f0b432c9d..69c2b84c6 100644 --- a/doc/README.md +++ b/doc/README.md @@ -996,7 +996,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection, callback|property [, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2016 "View in source") [Ⓣ][1] -Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*. +Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to group by *(e.g. 'length')*. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. diff --git a/lodash.js b/lodash.js index c090bbb7d..a0ed0bff3 100644 --- a/lodash.js +++ b/lodash.js @@ -1992,7 +1992,7 @@ * `collection` through a `callback`. The corresponding value of each key is an * array of elements passed to `callback` that returned the key. The `callback` * is bound to `thisArg` and invoked with three arguments; (value, index|key, collection). - * The `callback` argument may also be the name of a property to count by (e.g. 'length'). + * The `callback` argument may also be the name of a property to group by (e.g. 'length'). * * @static * @memberOf _ diff --git a/lodash.min.js b/lodash.min.js index c78e3f40c..4faf79c40 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -4,18 +4,18 @@ */ ;(function(e,t){function s(e){if(e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||Q),s=i?{}:e;if(i)for(n=t-1;++nn||e===t)return 1;if(ei;i++)r+="h='"+e.m[i]+"';if(","constructor"==e.m[i]&&(r+="!(f&&f.prototype===j)&&"),r+="g.call(j,h)){w=j[h];"+e.j+"}"}if(e.c||e.k)r+="}"}return r+=e.d+";return r",Function("e,g,i,n,l,q,t,v","return function("+ -t+"){"+r+"}")(f,dt,v,Vt,St,mt,Dt,yt)}function c(e){return"\\"+$t[e]}function h(e){return tn[e]}function p(){}function d(e){return nn[e]}function v(e){return yt.call(e)==Ct}function m(e){return"function"==typeof e}function g(e){var t=i;if(!e||"object"!=typeof e||v(e))return t;var n=e.constructor;return(!Rt||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!m(n)||n instanceof n)?Ht?(Gt(e,function(e,n,r){return t=!dt.call(r,n),i}),t===i):(Gt(e,function(e,n){t=n}),t===i||dt.call(e,t)):t}function y -(e){var t=[];return Yt(e,function(e,n){t.push(n)}),t}function b(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=Vt[typeof e]){var u=yt.call(e);if(!Xt[u]||Ft&&v(e))return e;var a=u==kt,n=a||(u==Mt?en(e):n)}if(!n||!t)return n?a?gt.call(e):sn({},e):e;n=e.constructor;switch(u){case Lt:case At:return new n(+e);case Ot:case Dt:return new n(e);case _t:return n(e.source,rt.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?un:Yt)(e,function( -e,n){f[n]=b(e,t,r,s,o)}),f}function w(e){var t=[];return Gt(e,function(e,n){m(e)&&t.push(n)}),t.sort()}function E(e){var t={};return Yt(e,function(e,n){t[e]=n}),t}function S(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=yt.call(e);if(u!=yt.call(t))return i;switch(u){case Lt:case At:return+e==+t;case Ot:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case _t:case Dt:return e==t+""}var a=u==kt||u==Ct;if(Ft&&!a&&(a=v(e))&&!v(t))return i;if(!a){if(e.__wrapped__||t.__wrapped__)return S -(e.__wrapped__||e,t.__wrapped__||t);if(u!=Mt||Rt&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+"")))return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!m(u)||!(u instanceof u&&m(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=S(e[l],t[l],s,o)););return f}for(var c in e)if(dt.call(e,c)&&(l++,!dt.call(t -,c)||!S(e[c],t[c],s,o)))return i;for(c in t)if(dt.call(t,c)&&!(l--))return i;if(Pt)for(;7>++u;)if(c=ft[u],dt.call(e,c)&&(!dt.call(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==K&&(u=[],a=[],o=i.length);for(;++sr&&(r=n,o=e)});else for(;++io&&(o=e[i]);return o}function M(e,t){var n=[];return un(e,function(e){n.push(e[t])}),n}function _(e,t,n,r){var s=3>arguments.length,t=f(t,r);return un(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function D(e,t,n,r){var s=e,o=e?e.length -:0,u=3>arguments.length;if("number"!=typeof o)var a=on(e),o=a.length;else qt&&yt.call(e)==Dt&&(s=e.split(""));return un(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function P(e,t,n){var r,t=f(t,n);return un(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function H(e,t,n){if(e)return t==r||n?e[0]:gt.call(e,0,t)}function B(e,t){for(var n=-1,r=e?e.length:0,i=[];++nn?xt(0,i+n):n||0)-1;else if(n)return r=I(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])j(a,r))a.push(r),u.push(e[s]);return u}function R(e,t){return zt||bt&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/ +.exec(t)[0],r="var h,w,j="+e.e+",r="+e.e+";if(!"+e.e+")return r;"+e.n+";",e.c&&(r+="var k=j.length;h=-1;",e.j&&(r+="if(typeof k=='number'){"),e.l&&(r+="if(v.call(j)==t){j=j.split('')}"),r+="while(++hi;i++)r+="h='"+e.m[i]+"';if(","constructor"==e.m[i]&&(r+="!(f&&f.prototype===j)&&"),r+="g.call(j,h)){w=j[h];"+e.j+"}"}if(e.c||e.k)r+="}"}return r+=e.d+";return r",Function("e,g,i,n,l,q,t,v","return function("+t+"){"+r+"}")(f,dt,v,Vt,St,mt,Dt, +yt)}function c(e){return"\\"+$t[e]}function h(e){return tn[e]}function p(){}function d(e){return nn[e]}function v(e){return yt.call(e)==Ct}function m(e){return"function"==typeof e}function g(e){var t=i;if(!e||"object"!=typeof e||v(e))return t;var n=e.constructor;return(!Rt||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!m(n)||n instanceof n)?Ht?(Gt(e,function(e,n,r){return t=!dt.call(r,n),i}),t===i):(Gt(e,function(e,n){t=n}),t===i||dt.call(e,t)):t}function y(e){var t=[];return Yt(e,function( +e,n){t.push(n)}),t}function b(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=Vt[typeof e]){var u=yt.call(e);if(!Xt[u]||Ft&&v(e))return e;var a=u==kt,n=a||(u==Mt?en(e):n)}if(!n||!t)return n?a?gt.call(e):sn({},e):e;n=e.constructor;switch(u){case Lt:case At:return new n(+e);case Ot:case Dt:return new n(e);case _t:return n(e.source,rt.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?un:Yt)(e,function(e,n){f[n]=b(e,t,r,s,o)}),f}function w +(e){var t=[];return Gt(e,function(e,n){m(e)&&t.push(n)}),t.sort()}function E(e){var t={};return Yt(e,function(e,n){t[e]=n}),t}function S(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=yt.call(e);if(u!=yt.call(t))return i;switch(u){case Lt:case At:return+e==+t;case Ot:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case _t:case Dt:return e==t+""}var a=u==kt||u==Ct;if(Ft&&!a&&(a=v(e))&&!v(t))return i;if(!a){if(e.__wrapped__||t.__wrapped__)return S(e.__wrapped__||e,t.__wrapped__||t +);if(u!=Mt||Rt&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+"")))return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!m(u)||!(u instanceof u&&m(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=S(e[l],t[l],s,o)););return f}for(var c in e)if(dt.call(e,c)&&(l++,!dt.call(t,c)||!S(e[c],t[c],s,o)))return i;for( +c in t)if(dt.call(t,c)&&!(l--))return i;if(Pt)for(;7>++u;)if(c=ft[u],dt.call(e,c)&&(!dt.call(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==K&&(u=[],a=[],o=i.length);for(;++sr&&(r=n,o=e)});else for(;++io&&(o=e[i]);return o}function M(e,t){var n=[];return un(e,function(e){n.push(e[t])}),n}function _(e,t,n,r){var s=3>arguments.length,t=f(t,r);return un(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function D(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if("number"!=typeof +o)var a=on(e),o=a.length;else qt&&yt.call(e)==Dt&&(s=e.split(""));return un(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function P(e,t,n){var r,t=f(t,n);return un(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function H(e,t,n){if(e)return t==r||n?e[0]:gt.call(e,0,t)}function B(e,t){for(var n=-1,r=e?e.length:0,i=[];++nn?xt(0,i+n):n||0)-1;else if( +n)return r=I(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])j(a,r))a.push(r),u.push(e[s]);return u}function R(e,t){return zt||bt&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/ ,Z=/&(?:amp|lt|gt|quot|#x27);/g,et=/\b__p\+='';/g,tt=/\b(__p\+=)''\+/g,nt=/(__e\(.*?\)|\b__t\))\+'';/g,rt=/\w*$/,it=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,st=RegExp("^"+($.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ot=/($^)/,ut=/[&<>"']/g,at=/['\n\r\t\u2028\u2029\\]/g,ft="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),lt=Math.ceil,ct=V.concat,ht=Math.floor,pt=st.test(pt=Object.getPrototypeOf )&&pt,dt=$.hasOwnProperty,vt=V.push,mt=$.propertyIsEnumerable,gt=V.slice,yt=$.toString,bt=st.test(bt=gt.bind)&&bt,wt=st.test(wt=Array.isArray)&&wt,Et=e.isFinite,St=st.test(St=Object.keys)&&St,xt=Math.max,Tt=Math.min,Nt=Math.random,Ct="[object Arguments]",kt="[object Array]",Lt="[object Boolean]",At="[object Date]",Ot="[object Number]",Mt="[object Object]",_t="[object RegExp]",Dt="[object String]",Pt,Ht,Bt=(Bt={0:1,length:1},V.splice.call(Bt,0,1),Bt[0]),jt=n;(function(){function e(){this.x=1}var t= [];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)jt=!n;Pt=!/valueOf/.test(t),Ht="x"!=t[0]})(1);var Ft=!v(arguments),It="x"!=gt.call("x")[0],qt="xx"!="x"[0]+Object("x")[0];try{var Rt=("[object Object]",yt.call(e.document||0)==Mt)}catch(Ut){}var zt=bt&&/\n|Opera/.test(bt+yt.call(e.opera)),Wt=St&&/^.+$|true/.test(St+!!e.attachEvent),Xt={};Xt[Ct]=Xt["[object Function]"]=i,Xt[kt]=Xt[Lt]=Xt[At]=Xt[Ot]=Xt[Mt]=Xt[_t]=Xt[Dt]=n;var Vt={"boolean":i,"function":n,object:n,number:i,string