💄 Use destructuring to shift arguments

This commit is contained in:
Steve Kinney 2016-05-07 08:55:26 -06:00
parent 6708e2a302
commit f3e633eb2c

View file

@ -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