mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
💄 Cache last argument in parseArgs
This is to eliminate the need to access the array twice.
This commit is contained in:
@@ -35,8 +35,9 @@ var parseArgs = function (window, options, callback, ...args) {
|
||||
}
|
||||
|
||||
// Fallback to using very last argument as the callback function
|
||||
if ((callback == null) && typeof args[args.length - 1] === 'function') {
|
||||
callback = args[args.length - 1]
|
||||
var lastArgument = args[args.length - 1]
|
||||
if ((callback == null) && typeof lastArgument === 'function') {
|
||||
callback = lastArgument
|
||||
}
|
||||
|
||||
return [window, options, callback]
|
||||
|
||||
Reference in New Issue
Block a user