/** Used to detect hot functions by number of calls within a span of milliseconds. */varHOT_COUNT=800,HOT_SPAN=16;/* Built-in method references for those with the same name as other `lodash` methods. */varnativeNow=Date.now;/** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */functionshortOut(func){varcount=0,lastCalled=0;returnfunction(){varstamp=nativeNow(),remaining=HOT_SPAN-(stamp-lastCalled);lastCalled=stamp;if(remaining>0){if(++count>=HOT_COUNT){returnarguments[0];}}else{count=0;}returnfunc.apply(undefined,arguments);};}module.exports=shortOut;