mirror of
				https://github.com/taixingyiji/openit.git
				synced 2025-11-04 10:02:26 +00:00 
			
		
		
		
	Delete utils/rm directory
This commit is contained in:
		
							
								
								
									
										37
									
								
								utils/rm/node_modules/lodash/_shortOut.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										37
									
								
								utils/rm/node_modules/lodash/_shortOut.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,37 +0,0 @@
 | 
			
		||||
/** Used to detect hot functions by number of calls within a span of milliseconds. */
 | 
			
		||||
var HOT_COUNT = 800,
 | 
			
		||||
    HOT_SPAN = 16;
 | 
			
		||||
 | 
			
		||||
/* Built-in method references for those with the same name as other `lodash` methods. */
 | 
			
		||||
var nativeNow = 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.
 | 
			
		||||
 */
 | 
			
		||||
function shortOut(func) {
 | 
			
		||||
  var count = 0,
 | 
			
		||||
      lastCalled = 0;
 | 
			
		||||
 | 
			
		||||
  return function() {
 | 
			
		||||
    var stamp = nativeNow(),
 | 
			
		||||
        remaining = HOT_SPAN - (stamp - lastCalled);
 | 
			
		||||
 | 
			
		||||
    lastCalled = stamp;
 | 
			
		||||
    if (remaining > 0) {
 | 
			
		||||
      if (++count >= HOT_COUNT) {
 | 
			
		||||
        return arguments[0];
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      count = 0;
 | 
			
		||||
    }
 | 
			
		||||
    return func.apply(undefined, arguments);
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = shortOut;
 | 
			
		||||
		Reference in New Issue
	
	Block a user