💄 Use destructuring to shift arguments
This commit is contained in:
parent
6708e2a302
commit
f3e633eb2c
1 changed files with 2 additions and 5 deletions
|
@ -23,15 +23,12 @@ var messageBoxOptions = {
|
|||
var parseArgs = function (window, options, callback, ...args) {
|
||||
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
|
||||
// Shift.
|
||||
callback = options
|
||||
options = window
|
||||
window = null
|
||||
[callback, options, window] = [options, window, null]
|
||||
}
|
||||
|
||||
if ((callback == null) && typeof options === 'function') {
|
||||
// Shift.
|
||||
callback = options
|
||||
options = null
|
||||
[callback, options] = [options, null]
|
||||
}
|
||||
|
||||
// Fallback to using very last argument as the callback function
|
||||
|
|
Loading…
Reference in a new issue