mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Tweak _.uniqueId to avoid problems with buggy minifiers.
Former-commit-id: e940c336b227ce89661cd6ada5f3e722a0204318
This commit is contained in:
@@ -707,7 +707,7 @@ The wrapper functions `first` and `last` return wrapped values when `n` is passe
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
|
||||
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4217 "View in source") [Ⓣ][1]
|
||||
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4218 "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.
|
||||
|
||||
@@ -737,7 +737,7 @@ _.chain([1, 2, 3, 200])
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_prototypetostring"></a>`_.prototype.toString()`
|
||||
<a href="#_prototypetostring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4234 "View in source") [Ⓣ][1]
|
||||
<a href="#_prototypetostring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4235 "View in source") [Ⓣ][1]
|
||||
|
||||
Produces the `toString` result of the wrapped value.
|
||||
|
||||
@@ -758,7 +758,7 @@ _([1, 2, 3]).toString();
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_prototypevalueof"></a>`_.prototype.valueOf()`
|
||||
<a href="#_prototypevalueof">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4251 "View in source") [Ⓣ][1]
|
||||
<a href="#_prototypevalueof">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4252 "View in source") [Ⓣ][1]
|
||||
|
||||
Extracts the wrapped value.
|
||||
|
||||
@@ -3069,7 +3069,7 @@ _.uniqueId();
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_version"></a>`_.VERSION`
|
||||
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4416 "View in source") [Ⓣ][1]
|
||||
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4417 "View in source") [Ⓣ][1]
|
||||
|
||||
*(String)*: The semantic version number.
|
||||
|
||||
|
||||
@@ -4188,7 +4188,8 @@
|
||||
* // => '105'
|
||||
*/
|
||||
function uniqueId(prefix) {
|
||||
return (prefix == null ? '' : prefix + '') + (++idCounter);
|
||||
var id = ++idCounter;
|
||||
return (prefix == null ? '' : prefix + '') + id;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
2
lodash.min.js
vendored
2
lodash.min.js
vendored
@@ -33,6 +33,6 @@ u(i)||o.push(i)}return o},r.wrap=function(n,t){return function(){var r=[n];retur
|
||||
},r.isNull=function(n){return n===W},r.isNumber=O,r.isObject=x,r.isPlainObject=dr,r.isRegExp=function(n){return n instanceof RegExp||$t.call(n)==Ut},r.isString=A,r.isUndefined=function(n){return n===void 0},r.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?It(0,e+r):Tt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=H,r.noConflict=function(){return n._=at,this},r.random=function(n,t){return n==W&&t==W&&(t=1),n=+n||0,t==W&&(t=n,n=0),n+Ot(Bt()*((+t||0)-n+1))},r.reduce=T,r.reduceRight=B,r.result=function(n,t){var r=n?n[t]:W;
|
||||
return j(r)?n[t]():r},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:gr(n).length},r.some=M,r.sortedIndex=L,r.template=function(n,t,e){n||(n=""),e||(e={});var u,o,i=r.templateSettings,a=0,f=e.interpolate||i.interpolate||_t,l="__p+='",p=e.variable||i.variable,s=p;n.replace(RegExp((e.escape||i.escape||_t).source+"|"+f.source+"|"+(f===mt?yt:_t).source+"|"+(e.evaluate||i.evaluate||_t).source+"|$","g"),function(t,r,e,o,i,f){return e||(e=o),l+=n.slice(a,f).replace(bt,c),r&&(l+="'+__e("+r+")+'"),i&&(l+="';"+i+";__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),u||(u=i||ft.test(r||e)),a=f+t.length,t
|
||||
}),l+="';\n",s||(p="obj",u?l="with("+p+"){"+l+"}":(e=RegExp("(\\(\\s*)"+p+"\\."+p+"\\b","g"),l=l.replace(gt,"$&"+p+".").replace(e,"$1__d"))),l=(u?l.replace(lt,""):l).replace(pt,"$1").replace(st,"$1;"),l="function("+p+"){"+(s?"":p+"||("+p+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(s?"":",__d="+p+"."+p+"||"+p)+";")+l+"return __p}";try{o=Function("_","return "+l)(r)}catch(v){throw v.source=l,v}return t?o(t):(o.source=l,o)},r.unescape=function(n){return n==W?"":(n+"").replace(ct,g)
|
||||
},r.uniqueId=function(n){return(n==W?"":n+"")+ ++ut},r.all=$,r.any=M,r.detect=N,r.foldl=T,r.foldr=B,r.include=k,r.inject=T,vr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return St.apply(t,arguments),n.apply(r,t)})}),r.first=P,r.last=function(n,t,r){if(n){var e=n.length;return t==W||r?n[e-1]:v(n,It(0,e-t))}},r.take=P,r.head=P,vr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==W||e?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""
|
||||
},r.uniqueId=function(n){var t=++ut;return(n==W?"":n+"")+t},r.all=$,r.any=M,r.detect=N,r.foldl=T,r.foldr=B,r.include=k,r.inject=T,vr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return St.apply(t,arguments),n.apply(r,t)})}),r.first=P,r.last=function(n,t,r){if(n){var e=n.length;return t==W||r?n[e-1]:v(n,It(0,e-t))}},r.take=P,r.head=P,vr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==W||e?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""
|
||||
},r.prototype.value=J,r.prototype.valueOf=J,lr(["join","pop","shift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),lr(["push","reverse","sort","unshift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),lr(["concat","slice","splice"],function(n){var t=rt[n];r.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return new r(n)}}),Wt&&lr(["pop","shift","splice"],function(n){var t=rt[n],e="splice"==n;
|
||||
r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r})):Y?typeof module=="object"&&module&&module.exports==Y?(module.exports=r)._=r:Y._=r:n._=r})(this);
|
||||
6
vendor/underscore/underscore-min.js
vendored
6
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
2
vendor/underscore/underscore.js
vendored
2
vendor/underscore/underscore.js
vendored
@@ -1075,7 +1075,7 @@
|
||||
// Useful for temporary DOM ids.
|
||||
var idCounter = 0;
|
||||
_.uniqueId = function(prefix) {
|
||||
var id = '' + (++idCounter);
|
||||
var id = ++idCounter + '';
|
||||
return prefix ? prefix + id : id;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user