💄 Cache last argument in parseArgs
This is to eliminate the need to access the array twice.
This commit is contained in:
		
					parent
					
						
							
								f58b3f853e
							
						
					
				
			
			
				commit
				
					
						6708e2a302
					
				
			
		
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -35,8 +35,9 @@ var parseArgs = function (window, options, callback, ...args) { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Fallback to using very last argument as the callback function
 |   // Fallback to using very last argument as the callback function
 | ||||||
|   if ((callback == null) && typeof args[args.length - 1] === 'function') { |   var lastArgument = args[args.length - 1] | ||||||
|     callback = args[args.length - 1] |   if ((callback == null) && typeof lastArgument === 'function') { | ||||||
|  |     callback = lastArgument | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return [window, options, callback] |   return [window, options, callback] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Steve Kinney
				Steve Kinney